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?
Add a comment
|
1 Answer
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.
-
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. Commented Dec 8, 2019 at 16:15