WordPress.org

Ready to get started?Download WordPress

Forums

WP-LESS
Compile directory (2 posts)

  1. Barryvdh
    Member
    Posted 2 years ago #

    I have some problems with paths, when I include the plugin in a theme (Roots Theme)

    I use this code:

    <?php
    require_once locate_template('/inc/wp-less/bootstrap-for-theme.php');          // LESS preprocessor
    $WPLessPlugin->getConfiguration()->setUploadUrl(get_stylesheet_directory_uri());
    $WPLessPlugin->getConfiguration()->setUploadDir(get_stylesheet_directory());
    $WPLessPlugin->dispatch();
    
    function theme_wp_hook( ) {
    	$template_dir = str_replace("wp-content/", '', get_stylesheet_directory_uri());
    	wp_enqueue_style( 'bootstrap-less',   $template_dir . '/style.less', array( ), false, 'screen,projection' );
    }
    add_action( 'wp', 'theme_wp_hook' );
    ?>

    The library is in the parent theme (roots/inc/wp-less), and the less files either in the roots theme, or a child theme.

    Problem 1:
    When I use get_stylesheet_directory_uri(), the compiler will try to compile the wrong directory. (/home/admin/domains/DOMAIN.nl/public_html/wp1/wp-content/wp-content/themes/roots-child/style.less <-- double wp-content)
    This can be fixed with manually removing wp-content, but is a bit strange.

    Problem 2:
    The file is now compiled, but the directory is wrong:
    /wp-content/themes/roots-child/themes/roots-child/style-e450ce6cfc.css
    This should be /wp-content/themes/roots-child/style-e450ce6cfc.css, (style-xx.css in the same dir as style.less). This way I can use relative images and don't mess up my folder..
    (Ok, it does kinda work, but not the right way..)

    Otherwise great plugin (but an update for the latest release should help, but is easy to do by myself)

    http://wordpress.org/extend/plugins/wp-less/

  2. oncletom
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Barry,

    tell me if the latest update solve your problem.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.