5

I use Magento 2 custom theme and when I made changes to .less file, I wanted to compile files, so I deleted pub/static folder and made deploy: php bin/magento setup:static-content:deploy. After that, no css files are found in pub/static/frontend/<Theme>/default/css. Also, when I use grunt less, I got errors:

>> Destination pub/static/frontend/Magento/blank/en_US/css/styles-m.css not written because no source files were found.
>> Destination pub/static/frontend/Magento/blank/en_US/css/styles-l.css not written because no source files were found.
>> Destination pub/static/frontend/Magento/blank/en_US/css/email.css not written because no source files were found.
>> Destination pub/static/frontend/Magento/blank/en_US/css/email-inline.css not written because no source files were found.

I am in a developer mode.

Does anyone have any solution for this?

Thank you

1
  • 'pub/static' should be writable.
    – Sohel Rana
    Commented Jun 15, 2016 at 14:18

2 Answers 2

12

You need to run grunt exec and then grunt less.

3
  • 1
    Could not get grunt watch to work after clearing static-content, this solution solved it. Thanks @Aaron!
    – jamil
    Commented Jun 21, 2017 at 15:21
  • Great! Can you mark this as the answer?
    – Aaron
    Commented Jun 24, 2017 at 23:44
  • 1
    It wasn't my question, just letting other users know this is a working solution :D I wish you many upvotes
    – jamil
    Commented Jun 26, 2017 at 16:28
2

It could be because you deleted the .htaccess file from pub/static. It can be found here https://github.com/magento/magento2/blob/develop/pub/static/.htaccess. Next time run rm -rf pub/static/* var/view_preprocessed/* instead of deleting the directory.

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.