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

Call to undefined method WPLessCompiler::setVariables() #1

Open
toffeefolk opened this issue Dec 5, 2013 · 6 comments
Open

Call to undefined method WPLessCompiler::setVariables() #1

toffeefolk opened this issue Dec 5, 2013 · 6 comments

Comments

@toffeefolk
Copy link

Using this on a local test setup.

Have simply replaced the old wp-less folder with new wp-lesscss folder and I am faced with the following error:

Fatal error: Call to undefined method WPLessCompiler::setVariables() in /Applications/MAMP/htdocs/devproject/wp-content/themes/bootstrap3/functions/wp-less/lib/Plugin.class.php on line 274

@bassjobsen
Copy link
Owner

@markjames9 thanks for reporting. I'm going to test this.
BTW you say to replace wp-less with wp-lesscss, but your error is in wp-less or did you copy the files to wp-less?

@toffeefolk
Copy link
Author

I replaced the files in the wp-less folder with the files from the wp-lesscss folder.

It is an implementation at theme level (wp-content/themes/bootstrap/functions/wp-less)

I will try it tomorrow as a plugin.

I am also wondering if it is an autoloading issue on the MAMP setup? I will do some testing and report back.

@toffeefolk
Copy link
Author

I cannot work this issue out.

The error occurs both as a plugin and a theme based include.

It wasn't as issue in the original files.

@bassjobsen
Copy link
Owner

@markjames9 thanks again for posting and testing. I found setVariables has not been implement in WPLessPlugin yet. I will try to do this asap, but i have to understand howto create a proper instance of the compiler in the first place, see also: thom4parisot/wp-less#51

@oyejorge
Copy link

oyejorge commented Feb 2, 2014

Version 1.6.1 of less.php implements a modifyVars() method that should be helpful

@nicmare
Copy link

nicmare commented Mar 15, 2014

same problem here. i try to use custom less variables defined in my theme functions.php but get the error: Call to undefined method WPLessCompiler::setVariables()
my code:

if (class_exists('WPLessPlugin')){
    $less = WPLessPlugin::getInstance();
    $less->addVariable('myColor', '#666');
    // you can now use @myColor in your *.less files

    $less->setVariables(array(
        'myColor' => '#777',
        'minSize' => '18px'
    ));
    // you can now use @minSize in your *.less files
    // @myColor value has been updated to #777
}

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

4 participants