Title: [Plugin: WP-LESS] Compile directory
Last modified: August 20, 2016

---

# [Plugin: WP-LESS] Compile directory

 *  [Barryvdh](https://wordpress.org/support/users/barryvdh/)
 * (@barryvdh)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-less-compile-directory/)
 * 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/](http://wordpress.org/extend/plugins/wp-less/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [thom4](https://wordpress.org/support/users/oncletom/)
 * (@oncletom)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-wp-less-compile-directory/#post-2932086)
 * Hi Barry,
 * tell me if the latest update solve your problem.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: WP-LESS] Compile directory’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-less.svg)
 * [WP-LESS](https://wordpress.org/plugins/wp-less/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-less/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-less/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-less/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-less/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-less/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [thom4](https://wordpress.org/support/users/oncletom/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-wp-less-compile-directory/#post-2932086)
 * Status: not resolved