thom4parisot / wp-less

WordPress plugin which seemlessly compiles, caches and rebuilds your LESS stylesheets.
https://wordpress.org/plugins/wp-less/
88 stars 40 forks source link

blocker! @import doesn't work properly for second less file #88

Closed gitowiec closed 9 years ago

gitowiec commented 9 years ago

I have two less files that include variables.less, both are hosted by the page at the same time (same paths), first is main.less and second is events.less.

wp_enqueue_style('theme-main', get_stylesheet_directory_uri() . '/less/main.less', array('genericons','bootstrap',));
wp_enqueue_style('theme-extra', get_stylesheet_directory_uri() . '/less/event-content.less', array('theme-main'));

At the beginning of main.less and events.less file I entered @import 'variables.less'; Content of variables.less is:

@fontRedColor: #8b0b0a;
.redInk{
    color: @fontRedColor;
}
@fontDarkColor: #353535;
@fontMenuColor: #fffff0;
@backgroundColor: #fffff0;
@backgroundRedColor: #8b0b0a;
@borderColor : #dadac3;
@face:'Source Sans Pro';

All I got in main.less is ok, classes are added, variables are substituted, but in events.less css classes from variables.less and variables are missing!

thom4parisot commented 9 years ago

Does it work with newer version of the plugin? It might have been related to a Less compiler bug.

Also make sure import dirs are known.

Nemesisprime commented 9 years ago

This issue was introduced in 1.7.6 for me, the second import in the second file seems to fail; I have an equivalent of "variables.less" in a directory whose path is added to the Import Directories and can import it into a single stylesheet. If I try to import it into a second, it fails. Possibly related to the "@import (once)" default behavior in Less?

I haven't yet come to a solution and am still looking for what changed to start this behavior; also going to give 1.8 a try now that it is posted.

Nemesisprime commented 9 years ago

Good news, looks like it was an issue with the compiler and I'm not crazy.

thom4parisot commented 9 years ago

Cool, good news :-)