Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less File Not Found/Handled in Plugin Using WP-Less #78

Open
ghost opened this issue Aug 3, 2015 · 0 comments
Open

Less File Not Found/Handled in Plugin Using WP-Less #78

ghost opened this issue Aug 3, 2015 · 0 comments

Comments

@ghost
Copy link

ghost commented Aug 3, 2015

Hello

I am attempting to use WP-Less in my plugin. I am hoping its possible to use WP-LESS in a plugin? This would save me alot of time if its possible. Also does WP-LESS compile less server side or is less handled client side - hopefully its server side.

I have a very simple Plugin that imports WP-LESS and an admin page should show its working by having some text styled. But the text isn't styled and its not finding the main.less file (its says its not found). Below are details of the error and the simple code - see the attached images for the error output and plugin directory structure.

capture2

![capture](https://cloud.githubusercontent.com/assets/10113201/9029031/f3f77c08-39ce-11e5-9635-f28e9b525a45.PNG)

Plugin Code:

/**
*  Plugin Name: TEST Load Less
*  Plugin URI: NA
*  Description: Test Development Plugin
*  Version: 1.0.0
*  Author: NA
*  Author URI: NA
*  License: GPL2
*/ 


add_action('admin_menu', 'TEST_admin_menu');
add_action('admin_init', 'include_less');
add_action('admin_print_scripts', 'include_less');
add_action('admin_print_styles', 'include_less');
add_action('admin_enqueue_scripts', 'TEST_enqueue_scripts');
add_action('wp_enqueue_scripts', 'TEST_enqueue_scripts');

// What action should less be included in? admin_init?
function include_less() {
    require_once( 'wp-less/wp-less.php' );
}

function TEST_admin_menu() {
    include_less();

    add_menu_page('TEST_DEV', 'TEST_DEV', 'administrator', 'TEST_DEV_SLUG', 
                    'show_TEST_page', 
                    plugins_url('images/help.png', __FILE__));
}

function TEST_enqueue_scripts() {

    require_once( 'wp-less/wp-less.php' );
    wp_enqueue_style( 'less-style', plugins_url( '/main.less', __FILE__ ) );
}

function show_TEST_page() {
    ?>
    <div class="wrap">
        <div>
            <p>No styling</p>
            <button class="btn">Abcdef</button>
        </div>

        <div class="my-less-namespace">
            <p>I should have styling from my less file</p>
            <button class="btn">Abcdef</button>
        </div>
        </div>
    <?php
}

?>```


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants