How to override CSS file in custom theme in magento 2

China☆狼群 提交于 2019-12-12 01:27:51

问题


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 watch 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!