cancel
Showing results for 
Search instead for 
Did you mean: 

Import new less file?

SOLVED

Import new less file?

 

Hello

My theme inherits from the blank theme (have actually copied all the less files from Blank to my theme. Bad decision? Smiley Frustrated).

 

Now I want to import a new less file to be complied together with the rest of the files. In which file is the "best" to make the import? I tried first to add

@import 'source/_themeone.less';

at the end of css/_styles.less. But it was overwritten in the compiled css file. Tried instead in the css/source/_theme.less, and that seems to work.

 

Is this "okay"? 

 

Best,

Magnus

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Import new less file?

Hi @Brake6

 

Well your second approach seems correct over here.

 

When you are create a custom theme your _theme.less file location should be like below :

 

VendorName\ThemeName\web\css\source\_theme.less

 

over there you need to write that import line to inherit the parent theme !!

 

You can also create your custom css on the below path :  VendorName\ThemeName\web\css\source\_extend.less 

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

View solution in original post

Re: Import new less file?

It is ok,

Also, you can write your own CSS in

css/source/_extend.less 

file. If you don't want to create custom LESS file.

 

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

3 REPLIES 3

Re: Import new less file?

Hi @Brake6

 

Well your second approach seems correct over here.

 

When you are create a custom theme your _theme.less file location should be like below :

 

VendorName\ThemeName\web\css\source\_theme.less

 

over there you need to write that import line to inherit the parent theme !!

 

You can also create your custom css on the below path :  VendorName\ThemeName\web\css\source\_extend.less 

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

Re: Import new less file?

It is ok,

Also, you can write your own CSS in

css/source/_extend.less 

file. If you don't want to create custom LESS file.

 

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Import new less file?

how to import a custom css.????