Magento 2 Adding custom .less & css
How to Import custom less css
1- add new file this location
(app\design\frontend\Vendor\Themename\web\css\source\_custom.less)
2-and import _custom.less file in _sources.less
(app\design\frontend\Vendor\Themename\web\css\source\_sources.less)
@import '_custom.less';
3- Run static content deploy> Go to Root of M2 setup php bin/magento setup:static-content:deploy
How to Override default less file
1-Copy file form vendor/magento/theme-frontend-blank/web/css/styles-l.less
2- Paste file here(app\design\frontend\Vendor\Themename\web\css\)
In styles-l.less file import _styles.less and in _styles.less import _sources.less
3- Run static content deploy> Go to Root of M2 setup php bin/magento setup:static-content:deploy
How to Import custom css file
1-add new file this location
(app\design\frontend\Vendor\Themename\web\css\_custom1.less)
2-call _custom1.less to (app/design/frontend/Mycustom/newtheme/Magento_Theme/layout/default_head_blocks.xml) <css src="css/_custom1.less" />
Comments
Post a Comment