Skip to content
oncletom edited this page Nov 24, 2012 · 6 revisions

API

Processing Workflow

This is part of the WordPress Action Refererence.

  1. wp-less_compiler_construct_pre WP-LESS action
  2. wp-less_compiler_construct WP-LESS filter
  3. wp-less_init WP-LESS action
  4. plugin_loaded WordPress action
  5. after_setup_theme WordPress action
  6. init WordPress action
  7. wp WordPress event
  8. wp_head WordPress action
  9. wp-less_plugin_process_stylesheets WP-LESS action during wp_enqueue_scripts
  10. Then, for each stylesheet:
    1. wp-less_stylesheet_construct WP-LESS action
    2. wp-less_stylesheet_compute_target_path WP-LESS filter
    3. wp-less_stylesheet_save_pre WP-LESS action (if it has to compile)
    4. wp-less_stylesheet_save WP-LESS filter (it it has to compile)
    5. wp-less_stylesheet_save_post WP-LESS action (it it has to compile)
  11. wp_print_styles WordPress action

This workflow means if you have to alter some configuration values, it has to be done before wp priority 999.

It also means if you register stylesheets after wp action, they won’t be handled by the plugin.

Plugin Hooks

WPLessPlugin Class

You can access to the known instance of WPLessPlugin at any time by doing the following:

$less = WPLessPlugin::getInstance();

// do stuff with its API like:
$less->addVariable('red', '#f00');

addVariable

TBD.

setVariables

TBD.

registerFunction

TBD.

unregisterFunction

TBD.

addImportDir

TBD.

setImportDir

TBD.

getImportDir

TBD.

install

TBD.

uninstall

TBD.

processStylesheet

TBD.

processStylesheets

TBD.

WPLessConfiguration Class

You can access to the known instance of WPLessConfiguration at any time by doing the following:

$config = WPLessPlugin::getInstance()->getConfiguration();

// do stuff with its API like:
$config->setCompilationStrategy('legacy');
$config->getTtl();	// returns 432000 (5 days)

getConfigurationStrategy

TBD.

alwaysRecompile

TBD.

setConfigurationStrategy

TBD.

getTtl

TBD.

Scheduled Tasks

TBD.