How to use variables in different less files?

less

Solution

You have to import your variables.less to all files which use your variables.

Edit:

You have to compile only your style.less. You cannot compile the main.less because it doesn't know the variables.less but you don't want a main.CSS anyway, do you? You should get the correct style.css which is (I guess) the only css file you'll need.

Problem

Let's say I separate a less files into many less files to be easy to organize. Here is my repository: ``` /reset.less /variables.less /mixins.less /main.less /styles.less ``` The styles.less is just importing the other files: ``` @import "reset.less"; @import "mixins.less"; @import "variables.less"; @import "main.less"; ``` However, when I add some codes into main.less and use the @line-color which is defined in the variables.less. It shows Name `Error: variable @line-color is undefined` and I cannot compile it- I use PHPStorm with less plugin. Could you pleas suggest me?

Original source