示例#1
0
 *
 * And to apply automatic building on page display:
 * `add_action('wp_print_styles', array($WPScssPlugin, 'processStylesheets'));`
 * Or apply all hooks with:
 * `$WPScssPlugin->dispatch();`
 *
 * You can rebuild all stylesheets at any time with:
 * `$WPScssPlugin->processStylesheets();`
 *
 * Or a specific stylesheet:
 * `wp_enqueue_style('my_css', 'path/to/my/style.css');`
 * `$WPScssPlugin->processStylesheet('my_css');`
 *
 * = Filters and hooks aren't enough =
 *
 * Build your own flavour and manage it the way you want. Simply extends WPScssPlugin and/or WPScssConfiguration.
 * Dig in the code to see what to configure. I tried to make things customizable without extending classes!
 */
/*
 * This will be effective only if the plugin is not activated.
 * You can then redistribute your theme with this loader fearscssly.
 */
if (!class_exists('WPScssPlugin')) {
    require dirname(__FILE__) . '/lib/Plugin.class.php';
    $WPScssPlugin = WPPluginToolkitPlugin::create('WPScss', __FILE__, 'WPScssPlugin');
    //READY and WORKING
    //add_action('after_setup_theme', array($WPScssPlugin, 'install'));
    // NOT WORKING
    //@see http://core.trac.wordpress.org/ticket/14955
    //add_action('uninstall_theme', array($WPScssPlugin, 'uninstall'));
}
<?php

/*
Plugin Name: WP LESS
Description: LESS extends CSS with variables, mixins, operations and nested rules. This plugin magically parse all your <code>*.less</code> files queued with <code>wp_enqueue_style</code> in WordPress.
Author: Oncle Tom
Version: 1.4.2
Author URI: http://case.oncle-tom.net/
Plugin URI: http://wordpress.org/extend/plugins/wp-less/

  This plugin is released under version 3 of the GPL:
  http://www.opensource.org/licenses/gpl-3.0.html
*/
require dirname(__FILE__) . '/lib/Plugin.class.php';
$WPLessPlugin = WPPluginToolkitPlugin::create('WPLess', __FILE__);
$WPLessPlugin->dispatch();