Archived

This topic is now archived and is closed to further replies.

  • 0

PageLess Doesn't work with LESS Variables?

Question

3 answers to this question

Posted · Report post

This topic was tagged with PageLESS but there are screenshots of PageLESS and LESS Developer so I'm not exactly sure what product this topic is indended for.

 

First of all I want to say that both PageLESS and LESS Developer support LESS variables 100%.

 

From your screenshots, it looks like you're trying to define LESS variables in a .less file with LESS Developer and then call those up in PageLESS.  That's not going to work.  This is not a shortcoming of the product, but just how the LESS compiler works.

 

In order for new LESS variables to be available in PageLESS, they need to be properly added using the 'pless_vars' filter OR present in your theme's colors.less or variables.less override files if you're using them - otherwise the core frameworks files by the same name will be loaded.  I recommend just using the filter, it's very easy and doesn't require overriding any files.

 

Use this code in your functions.php to add LESS variables:

<?php

add_filter('pless_vars', 'my_custom_vars);

function my_custom_vars( $vars ) {

$vars['tkcolor1'] = '#000000';
$vars['tkcolor2'] = '#ffffff';

return $vars;
}

Hope that helps!

1 person likes this

Share this post


Link to post
Share on other sites

Posted · Report post

Evan, yes, you understood my question completely (and put into words what I wasn't sure how to say).

 

Thanks for the code snippet.

 

I tested and when I put those LESS variables in my child theme's style.less instead of directly into the LESS compiler, the LESS Developer plugin did "work" correctly with them.

 

Thanks.

Share this post


Link to post
Share on other sites

Posted · Report post

I have alerted the developer of this topic.

Share this post


Link to post
Share on other sites