Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to load variables file that overrided by setVariables ? #622

Open
qaharmdz opened this issue Jan 28, 2016 · 2 comments
Open

How to load variables file that overrided by setVariables ? #622

qaharmdz opened this issue Jan 28, 2016 · 2 comments

Comments

@qaharmdz
Copy link

My code

// PHP
$less = new lessc;
$less->setVariables(array(
    'font-color' => '#333,
));
$less->compileFile($path . 'less/test.less', $path . 'test.css');

// LESS
@import "variables.less"; // font-color here #111
body {
  color: @font-color;
}

// Output
body {
    color: #111; // Expecting #333
}

I'm expecting the body color to be 333

Any help is appreciated

@qaharmdz
Copy link
Author

It would be awesome if we have loadVariables($file) to load variable file(s)

$less = new lessc;
$less->loadVariables($path . 'less/variable.less'); // @font-color: #111
$less->setVariables(array(
    'font-color' => '#333,
));
$less->compileFile($path . 'less/test.less', $path . 'test.css');

// LESS
body {
  color: @font-color;
}

// Output
body {
    color: #333;
}

@qaharmdz qaharmdz changed the title How to load default variables that override by setVariables ? How to load variables file that overrided by setVariables ? Jan 30, 2016
@rockneverdies55
Copy link

Wow. It's been almost 2 years and no response at all 😮 I guess it's not possible to callsetVariables first and then compile file with those variables/values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants