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.
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
}
?>```
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.
Plugin Code: