James
James

Reputation: 31

Can a LESS file refer to a LESS variables file without using @import?

I'm new to LESS, and I ask because I'm looking at a Weebly theme with a main.less file plus variables files for two color variations of the theme - variables_gold.less and variables_black.less.

Each variables file contains the same variables but with different values.

There are no @import lines in any of these files and no references to the variables files in any output code for the site that I can find. All information I've been able to find about referring to separate variables files involves @import, so I haven't yet been able to find an answer with general web searches. So does LESS just automatically look for other LESS files in the same directory for any undefined variables in a particular .less file, or must I conclude that the associations between these files are created through some other aspect of the theme's coding that I haven't found? (There don't appear to be any references to any of the above-mentioned .less files or any equivalently named .css files in the theme's HTML files or its output HTML that I can find, either, so I don't see it as just a case of different theme color versions having different HTML pages with different details in their link rel="stylesheet" lines.)

Thanks in advance for your thoughts on this.

Upvotes: 3

Views: 761

Answers (3)

James
James

Reputation: 31

I've been informed as follows:

The variables files are not imported into main.less. These files are defined in the manifest.json file, like the following example for variables_black.less:

"variations": [
        {
            "value" : "dark",
            "sample": "#111111 ",
            "is-dark": false
        },
        {
            "value" : "white",
            "sample": "#dfdfdf ",
            "is-dark": false
        },
        {
            "value" : "brown",
            "sample": "#53382f ",
            "is-dark": false
        }
    ],

Upvotes: 0

Jason Cemra
Jason Cemra

Reputation: 563

Since this is a specialized application for Weebly, there's a chance that the site is using a build process to concatenate a variable file before the style definitions, depending on your color theme settings. In this case, it would appear that the variable linking has nothing to do with LESS, but rather with an unseen build-process.

See this article for a more detailed description of what I'm referring to.

Upvotes: 2

Justinas
Justinas

Reputation: 43451

As far as I know you must use @import (usually at main less file). Otherwise it would be useless to have @import directive if it still looks at other .less files

Upvotes: 1

Related Questions