Frequently Asked Questions
Magento 2 allows you to compile the .less files by using one of these 3 modes:
Let’s see how they differ.
→ Need a hand with custom development? Our team is ready to help you out. Learn more about our Magento Custom Development Service.
This is a default Magento option. The system compiles files using the Less PHP library:
This mode allows you to see simple changes made in the theme right after saving them and refreshing the page. The workflow of this process is very similar to server-side Less compilation. The main difference is only in the last step. The client-side mode publishes the following files to the pub/static/frontend/<Vendor>/<theme>/<locale> folder:
Since LESS files are compiled after every page reloading, it may create too big JS files and decrease store performance.
The third option that Magento 2 offers is compilation via Grunt. This is a tool that can perform routine tasks like compilation automatically. Learn more about its configs from the Magento official documentation.
To set up one of the options, follow these steps:
Step 1. Log in to your admin panel and go to Stores > Settings > Configuration > ADVANCED > Developer.
Step 2. Open the Store View dropdown and choose the Default Config option.
Step 3. Then expand the Frontend development workflow section and choose the needed compilation mode in the Workflow type field.
Step 4. Save the changes.
Is .less not compiling in your Magento 2? Check how to fix it in the official guide.