Bob
Bob

Reputation: 169

Why my CSS file is empty after the LESS file is compiled?

I use LESS css and I am new to it. in my LESS file I have several variables for different colors:

@LightBlue: #0088CC;
@DarkPink: #C71C77;
@LightGreen: #76B51B;

I set @LightBlue as the default color:

@DefaultThemeColor: @LightBlue;

I created another LESS file, dark-pink.less to change the color of the theme. and in this file I just changed the variable color like this:

@LightGreen: #76B51B;

@DefaultThemeColor: @LightGreen; 

but after it is compiled to CSS file, I noticed that the CSS file is empty. what am I doing wrong?

Upvotes: 3

Views: 1963

Answers (1)

PRI.Kevin
PRI.Kevin

Reputation: 74

So far you have only set the variables, you haven't used them in any selector so less has nothing to compile.

Assigning any one of the variables like this for example should produce CSS in the compiled css file:

@LightGreen: #76B51B;

@DefaultThemeColor: @LightGreen; 

h1 { /* Use the variable like this */
    color:@LightGreen
}

Upvotes: 5

Related Questions