问题
In Magento 2, I have create new theme. I tried to add less file app/design/frontend/mage_vender/sample(theme)/web/css/source/_extend.less. But it is not showing changes. Please can anyone tell me, how can we do ? I am using magento 2.1.3 Thank you
回答1:
The first thing you need to do is to create your theme, don't forget to add all the required files like the theme.xml
and registration.php
. Last time I checked the magento 2 documentation it was up to date and had enough information regarding on how to create new themes.
Second thing you need to do is to add your new theme to the theme.js, other wise you will not be able to compile your new less files into CSS. You do this by adding a new json group into /dev/tools/grunt/configs/themes.js
Now to override less files for example lets says the _navigation.less you just need to put it under /app/design/frontend/[YOUR_THEME]/web/css/source/_navigation.less
Then do a grunt refresh
, you do this always when you add new files and grunt watc
h if you're editing one that has already been added.
来源:https://stackoverflow.com/questions/41302631/how-to-override-css-file-in-custom-theme-in-magento-2