Magento – Magento 2 setup:static-content:deploy symlinks

deploydeploymentmagento2static-content

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?

Best 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.