Support » Plugin: WP-LESS » Implementation with Roots Theme?

  • Hi there,

    I’m trying really hard to implement this plugin within my theme build with the Roots theme, but I can’t find any (proper) documentation about it anywhere…

    1) So I activated the plugin and in the theme file lib/scripts.php I replaced this line:
    wp_enqueue_style('roots_app', get_template_directory_uri() . '/assets/css/app.css', false, null);
    with this line:
    wp_enqueue_style('roots_app', get_template_directory_uri() . '/assets/less/app.less', false, null);
    but that doesn’t work at all, the whole site even breaks!

    I discovered it’s because of the Roots rewrite rules. When I disable the ‘template_directory_uri’ rewrites in the lib/rewrites.php file it does work!

    So I changed the line into:
    wp_enqueue_style('roots_app_less', get_bloginfo('url') .'/wp-content/themes/mytheme/assets/less/app-less.less');

    But it’s not very pretty, is there a workaround for this?

    2) Another issue; the compiled .css file ends up in this folder in the root:
    while I rather would like it compiled directly into the wp-content/themes/mytheme/assets/css folder.

    So I added this into my scripts.php file:

    if (class_exists('WPLessPlugin')){
    	$lessConfig = WPLessPlugin::getInstance()->getConfiguration();
    	// compiles in the active theme, in a ‘compiled-css’ subfolder
    	$lessConfig->setUploadDir(get_stylesheet_directory() . '/assets/css');
    	$lessConfig->setUploadUrl(get_stylesheet_directory_uri() . '/assets/css');

    But then the file doesn’t get compiled, probably because of the writing permissions…
    Any fixes for that?


  • The topic ‘Implementation with Roots Theme?’ is closed to new replies.