1

I am pretty new to Magento2 and my question may sound banana to most of you. I would like to know how can I compile my less file.

app/design/frontend/my_theme/web/css/source/_layout.less

thank you so much in advance

3

2 Answers 2

2

Remove var and pub/static folder and deploy static content again as per below commands.

rm -rf var/ pub/static/
php bin/magento setup:static-content:deploy
chmod -R 777 var/ pub/static/
2
  • thank you , that's exactly what I needed. I may add to check the permissions of var and pub/static folders after the deployment. In my case they turned into not 770
    – bourax
    Feb 15, 2018 at 13:27
  • You are welcome. I updated answer to add permission. Glad to know that it helped you. Thanks. Feb 15, 2018 at 15:04
1

Just run php bin/magento setup:static-content:deploy from your project root folder.

You might have to remove contents of pub/static or to be more granular affected files by your changes.

Source: The official docs http://devdocs.magento.com/guides/v2.1/config-guide/cli/config-cli-subcommands-static-view.html

Also if you want GRUNT to watch your changes see this http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html

In development environment you can also created symlinks as stated here http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-less-sass.html

Also you should take into consideration the possibility that your logic for adding the less file is faulty. Here are the official docs for adding style custom changes

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-guide/css_quick_guide_approach.html

3
  • the command didn't work for me. I run it with normal and root user, flushed and refreshed the caches. nothing work. the changes are in the less file but I see the old css in styles-l.css
    – bourax
    Feb 15, 2018 at 12:05
  • Please consider line added after edit "You might have to remove contents of pub/static or to be more granular affected files by your changes" this should be done before executing static-content:deploy Feb 15, 2018 at 12:07
  • @bourax don't mention it Feb 15, 2018 at 13:53

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