7

When removing all the pub/static files in Magento 2 and opening the homepage, the files are generated as symlinks. When using the command setup:static-content:deploy the files are copied, even after setting the deploy mode to developer with the command bin/magento deploy:mode:set developer. How can I get the static generated as symlinks from terminal, as in the browser it takes much more longer?

1 Answer 1

8

I was able to resolve this by adding this node in app/etc/di.xml

<type name="Magento\Deploy\Model\Deploy\LocaleDeploy">
        <arguments>
            <argument name="assetPublisher" xsi:type="object">developerPublisher</argument>
        </arguments>
    </type>

For magento 2.2 code will be

 <type name="Magento\Deploy\Service\DeployStaticFile">
    <arguments>
        <argument name="assetPublisher" xsi:type="object">developerPublisher</argument>
    </arguments>
</type>

Note that this approach means static files will always be deployed as symlinks, even in production.

1
  • I always though that this didn't work until I cleared out the var/view_preprocessed before deploying static content and now it definitely does work.
    – David Tay
    Commented Dec 8, 2019 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.