WordPress.org

Ready to get started?Download WordPress

Forums

WP-LESS
Correct way to add @import dynamically (2 posts)

  1. Markjj
    Member
    Posted 2 years ago #

    What is the correct way to add less import dynamically in one file.
    Something like:

    require THEME_DIR . '/inc/plugins/wp-less/bootstrap-for-theme.php';
    if(something) {
        $WPLessPlugin->addImport('mixins1.less');
    } else {
        $WPLessPlugin->addImport('mixins2.less');
    }
    $WPLessPlugin->dispatch( );
    
    function l_scripts() {
        wp_enqueue_style('style', get_bloginfo('template_directory').'/style.less', array(), '', 'screen, projection');
    }
    add_action( 'wp', 'l_scripts' );

    Is it at least possible?

    Thanks for help.

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

  2. Markjj
    Member
    Posted 2 years ago #

    I tried it adding using variables, but it doesn't seem to work.

    in php:
    $WPLessPlugin->addVariable(''@mixins-path", "/path/mixins.less");
    
    in less:
    @import @mixins-path;

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic