Custom .less files not compiling at all
-
24-03-2021 - |
Question
I have found that the less files are not compiling in my custom theme. at all. originally I discovered the problem when I made changes to my _extend. less file and no changes occurred, but now I have found that none of the .less files in my app/...web/source/CSS folder are compiling after the first loading of my website.
After downloading a fresh backup, I immediately made some changes to the CSS before opening the website online. this worked, but any consequent changes had no impact. I reversed the changes I had made and re-loaded the page by opening a new window. This reverted my original change, but any time after this no change is evident.
I am using xampp, with Magento 2.3.0 installed.
I have tried every fix found on this website and regular stack overflow, including clearing the cache, var folders and more using both commands and straight-up deleting the folders.
Please help.
Solution 3
I have found a solution.
When making any change to the .less files within your custom theme, follow the following four steps.
- Delete the files within:
<vendor>\var\view_preprocessed\pub\static\frontend\<vendor_theme>\en_NZ\css
- Delete the files within:
<vendor>\var\cache
- Delete the files within:
<vendor>\pub\static\frontend\<vendor_theme_name>\en_NZ\css
- If in production mode, run the
setup:static-content:deploy
command. If in developer mode, simply refresh the page you are attempting to style.
After following these steps, I was able to observe the changes I made to my website.
OTHER TIPS
Try using my extension to clear static content
https://github.com/DominicWatts/ClearStatic
Then try compiling again using static content deploy command
You can try this theme for less compilation from Github.