WordPress.org

Support

Support » Plugins and Hacks » WP-LESS » [Resolved] [Plugin: WP-LESS] WP 3.4

[Resolved] [Plugin: WP-LESS] WP 3.4

  • Hello all,

    Have a client whose previous developer was using wp-less. She just upgraded on her own to 3.4 and the plugin didn’t care for that. I didn’t built the site (complicated) and not sure that there was no core changes and or such and hoping to not have to try rolling it back.

    Anyone have any idea how to get it working again? Seems maybe it would work if I could just trick the plugin into thinking it’s 3.3, but couldn’t figure it out.

    Any ideas???

    Thanks!

    Philip

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

Viewing 12 replies - 1 through 12 (of 12 total)
  • I have no idea why so many say its broken with 3.4.x.
    I’m using it with WP 3.4.1 and it works fine. Anyway, you can disable the plugin and compile the .less file to .css, then change the line in funcions.php to include it in your theme, thats all.

    I use Simpless for compile the less file. Once you know about less you won’t miss it anymore πŸ˜‰

    It doesn’t work for me either on WordPress 3.4.2, running on Windows XAMPP. I’m developing a theme with the WordPress Roots theme. I created an app.less file and tried to write some code in it, but the output isn’t compiled to CSS.

    Is there any debug info that could help?

    I investigated further and noticed several issues:

    1. Roots theme uses the wp_enqueue_scripts action. It says here to use the wp action. Why is that so? Why doesn’t it work with the wp_enqueue_scripts hook?
    2. In the Roots theme there are some htaccess tricks to put all the stylesheets into /assets/css. It seems the WP-LESS plugin needs the full wp-content path to the file. Is this a bug? Any workarounds?

    Update – got it to work with the following code:

    function roots_enqueue_less() {
      wp_enqueue_style('roots_app', '/themes/mytheme/assets/css/app.less', array(), '', 'screen, projection');
    }
    
    add_action('wp', 'roots_enqueue_less');
    1. Full path following wp-content
    2. Using wp as the action

    In my opinion it should also work with wp_enqueue_scripts action and with the /assets trick.

    Plugin Author oncletom

    @oncletom

    Do you still encounter the problem?

    I don’t see any change with WP 3.4.x.

    Can you all copy/paste how you enqueue your CSS?

    Thanks πŸ™‚

    As I wrote above – the enqueued LESS file only works when it’s added to the ‘wp’ hook. When it’s added to ‘wp_enqueue_scripts’ it doesn’t work. At least not with the Roots theme:
    http://www.rootstheme.com/

    Plugin Author oncletom

    @oncletom

    wp_enqueue_scripts is far too late for a hook to make this working at the moment.

    I’ve described the Processing Workflow on the project wiki.

    I guess I could delay the LESS processing to the wp_print_styles action, in a low priority.

    Sorry, I meant wp_enqueue_style. Might want to change the instructions here: http://wordpress.org/extend/plugins/wp-less/faq/

    Plugin Author oncletom

    @oncletom

    I’ve digged in the code: they enqueue CSS files on wp_enqueue_scripts, which is AFTER wp action and before wp_print_styles.

    They recommend to compile files as yourtheme/style.css.
    Anyway, their way of registering CSS is not very handy, especially as it forces the browser to load 4 CSS files… which is counterproductive for performances.

    What I would do

    
    add_action('wp_enqueue_scripts', 'customize_roots_css', 200);
    add_action('init', 'my_less_styles');
    
    function customize_roots_css(){
      wp_dequeue_style('roots_bootstrap');
      wp_dequeue_style('roots_bootstrap_responsive');
      wp_dequeue_style('roots_app');
      wp_dequeue_style('roots_child');
    }
    
    function my_less_styles(){
      wp_enqueue_style('theme_main', get_stylesheet_directory_uri() . '/style.less');
    }
    
    

    Use @import to load bootstrap, responsive and roots CSS (if needed) to compile that in 1 working file.

    Plugin Author oncletom

    @oncletom

    Problem finally addressed by a contribution β€” https://github.com/oncletom/wp-less/pull/18

    Lands in 1.5.0.

    paulrudy

    @paulrudy

    THANK YOU. This works in roots theme now.

    Plugin Author oncletom

    @oncletom

    Cool, nice to hear that πŸ™‚

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Resolved] [Plugin: WP-LESS] WP 3.4’ is closed to new replies.
Skip to toolbar