Skip to content

Instantly share code, notes, and snippets.

@dovy
Created May 14, 2015 17:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dovy/2e57d6d5138d36efbe6a to your computer and use it in GitHub Desktop.
Save dovy/2e57d6d5138d36efbe6a to your computer and use it in GitHub Desktop.
<?php
function compiler_action( $options, $css, $changed_values ) {
$keys = array(
'header_color',
'header_footer_color'
);
$compile = false;
foreach ( $changed_values as $key => $value ) {
if ( in_array( $key, $keys ) ) {
$compile = true;
}
}
if ($compile) {
$string = "";
foreach ( $options as $key => $value ) {
if ( in_array( $key, $keys ) ) {
$string .= "@" . $key . ':' . $value . ';';
}
}
// RUN LESS COMPILER
}
echo '<h1>The compiler hook has run!</h1>';
echo "<pre>";
print_r( $changed_values ); // Values that have changed since the last save
echo "</pre>";
//print_r($options); //Option values
//print_r($css); // Compiler selector CSS values compiler => array( CSS SELECTORS )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment