Magento 2 grunt watch is not pre-processing LESS for main locale
Question
My core_config_data
table has general/locale/code
set to en_IE
. When I run grunt exec:<theme-name>
and then grunt less:<theme-name>
, CSS is generated in two separate locale folders, en_GB and en_IE. Both have the correct output CSS.
However, when I run grunt watch
and then change a LESS file, the change is registered and the page refreshes, but the change doesn't take effect in the browser. I can see that this is because the CSS is only updated in one locale (en_GB) and not the other (primary, en_IE).
Is there a way to tell grunt watch
to refresh CSS for all locales at the same time?
Solution
I found the answer. I had added my theme to the dev/tools/grunt/configs/themes.js
file, but had specified en_GB
instead of en_IE
.
To put it another way, the locale inside dev/tools/grunt/configs/themes.js
didn't match that set in the core_config_data
table.
OTHER TIPS
ow to Installing and configuring Grunt
- Install node.js to any location on your machine.
Install Grunt CLI tool globally. To do this, run the following command in a command prompt:
npm install -g grunt-cli
Rename 'Gruntfile.js.sample' to 'Gruntfile.js' And 'package.json.sample' to 'package.json'
Install (or refresh) the node.js project dependency, including Grunt, for your Magento instance. To do this, run the following commands in a command prompt: cd your_Magento_directory_name
npm install npm update
Then use Grunt commands