We are running Magento 2 in version 2.3.1, but the error occurred in version 2.3.0 also. The situation is the following:
- we've created a custom theme which has Magento/luma theme as parent.
- according to https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/css-topics/css_debug.html we've installed node and grunt for theme LESS development.
- the grunt themes.js config of our custom child theme has files:['css/styles-m', 'css/styles-l', 'css/style'] entries. (where 'styles-m' and 'styles-l' are files from the parent, and 'css/style' is our custom LESS file)
- our custom LESS file style.less is located in our custom VENDOR/THEME/web/css/ folder and is also registered as
<css src="css/style.css" />within default_head_blocks.xml of our theme.
Now the problem is, that executing commands grunt clean:THEME, grunt exec:THEME, grunt less:THEME and grunt watch will not create symlinked files within pub/static folder. Instead it copies the source stylesheets to the pub folder, and therefore grunt watch will not detect any changes. Of course I researched and checked solutions like cleaning cache, rebuilding anything and deploying static content before running the grunt tasks. (e.g. Magento 2 grunt exec does not actually create symlinks or What are the Magento 2 Grunt commands? From deployment?)
I also verified that there are no external imports within my custom style.less file. (https://github.com/magento/magento2/issues/1619#issuecomment-377472378) We're running under FreeBSD.
Do you have any idea why this happens, or did someone experience the same with m2? Thanks in advance for all your help!
- I added source/_custom.less according to Chandras comment(Magento 2 Theme Development - grunt watch not detecting changes of custom LESS file)
- I added the _custom.less to default_head_blocks and themes.js configuration. The result is: the less file gets generated, but also not symlinked to the source file, therefore grunt watch still does not recognize any change. Anyone any idea?