Last active
December 24, 2015 16:39
-
-
Save fabrizim/6829389 to your computer and use it in GitHub Desktop.
Use wp-less to process editor stylesheets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('mce_css', 'theme_mce_less'); | |
function theme_mce_less($css) | |
{ | |
$handle = 'editor'; | |
$less_plugin = WPLessPlugin::getInstance(); | |
wp_enqueue_style($handle, get_stylesheet_directory_uri()."/assets/stylesheets/editor.less"); | |
$less_plugin->processStylesheets(); | |
global $wp_styles; | |
$src = $wp_styles->registered[$handle]->src; | |
wp_dequeue_style($handle); | |
return $css ? $css.','.$src : $src; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment