Jump to content


Photo
PageLess

Doesn't work with LESS Variables?



Best Answer Evan Mattson , 29 March 2013 - 07:28 PM

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!

Go to the full post


  • Please log in to reply
3 replies to this topic

#1 CliffordP

CliffordP

    Advocate

  • Members


  • 455 posts
  • LocationOklahoma
  • Country: Country Flag

Posted 22 March 2013 - 02:30 PM

http://cl.ly/image/0N3U4428363v

woops, meant this: http://cl.ly/image/0I1p1h0N2c2w



#2 Jenny

Jenny

    Advocate

  • Unicorn Store Dev

  • 2924 posts
  • LocationWV
  • Country: Country Flag

Posted 28 March 2013 - 08:22 PM

I have alerted the developer of this topic.



#3 Evan Mattson

Evan Mattson

    Super Member

  • Members

  • 220 posts
  • LocationAnn Arbor, MI
  • Framework Version:latest stable & beta releases
  • Country: Country Flag

Posted 29 March 2013 - 07:28 PM   Best Answer

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!


  • Jenny likes this

#4 CliffordP

CliffordP

    Advocate

  • Members


  • 455 posts
  • LocationOklahoma
  • Country: Country Flag

Posted 30 March 2013 - 01:42 AM

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.







Also tagged with one or more of these keywords: PageLess