cancel
Showing results for 
Search instead for 
Did you mean: 

grunt:watch sees changes to theme less but changes not seen on frontend

grunt:watch sees changes to theme less but changes not seen on frontend

 

Hi there,

I'm on M2.3.1 (composer install) and am trying to set-up Grunt to automatically update the front-end CSS files when I change my custom theme's .less files.  My theme's parent is Magento\blank which I believe is being loaded from vendor/magento/theme-frontend-blank

 

My theme's vendor/theme = a1/lws

My dev/tools/grunt/configs/themes.js looks like this:

 

...
lws: { area: 'frontend', name: 'a1/lws', locale: 'en_US', files: [ 'css/styles-m', 'css/styles-l', 'css/email', 'css/email-inline' ], dsl: 'less' }

 

I am running in dev mode.

After running 

grunt exec:lws

grunt less:lws

grunt watch

My changes are seen by the grunt task runner:

 

$ grunt watch
Running "watch" task
Waiting...
>> File "pub/static/frontend/a1/lws/en_US/css/source/_theme.less" changed.
Running "less:lws" (less) task
>> 4 stylesheets created.
>> 4 sourcemaps created.

Done.


Execution Time (2019-05-09 16:58:25 UTC+1)
loading tasks               141ms  ▇ 2%
loading grunt-contrib-less   88ms  ▇ 1%
less:lws                     8.4s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 97%
Total 8.7s

Completed in 10.377s at Thu May 09 2019 16:58:34 GMT+0100 (BST) - Waiting...
>> File "pub/static/frontend/a1/lws/en_US/css/styles-m.css" changed.
>> File "pub/static/frontend/a1/lws/en_US/css/styles-l.css" changed.
>> File "pub/static/frontend/a1/lws/en_US/css/email.css" changed.
>> File "pub/static/frontend/a1/lws/en_US/css/email-inline.css" changed.
Completed in 0.000s at Thu May 09 2019 16:58:34 GMT+0100 (BST) - Waiting...

However the changes don't show up on the front end.  The CSS is being loaded from 

 

/static/version1557417466/frontend/a1/lws/en_GB/css/styles-l.css

 

If I delete view_processed folder AND pub/static/frontend/a1/lws/en_GB/css/styles-l.css then refresh I do see the change, but that is no different whether the grunt watch task is running or not.

 

Any ideas what I've missed please?

2 REPLIES 2

Re: grunt:watch sees changes to theme less but changes not seen on frontend

First run grunt refresh, then run grunt watch. Now reload your site and the changes should be visible.

Re: grunt:watch sees changes to theme less but changes not seen on frontend

grunt clean helped me on same situation.