Skip to content

Instantly share code, notes, and snippets.

@jmlweb
Created July 16, 2011 18:29
Show Gist options
  • Save jmlweb/1086619 to your computer and use it in GitHub Desktop.
Save jmlweb/1086619 to your computer and use it in GitHub Desktop.
Transitions plugin for Turbine (very very alpha state)
<?php
/**
* CSS3 Transitions Plugin for Turbine
* José Manuel Lucas
*
* http://github.com/jmlweb/turbine_transitions
*
*/
/**
* Automatic vendor prefixes for CSS3 transitions
*
*
* @param mixed &$parsed
* @return void
*/
function transitions(&$parsed){
global $cssp, $browser;
foreach($parsed as $block => $css){
foreach($parsed[$block] as $selector => $styles){
if(isset($parsed[$block][$selector]['transition'])){
foreach($styles as $property => $values){
if($property == 'transition'){
$transition_properties = array();
// Build prefixed properties
$prefixes = array('-moz-', '-webkit-', '-khtml-');
foreach($prefixes as $prefix){
$str = '';
foreach($parsed[$block][$selector]['transition'] as $transition_value){
$str .= $transition_value;
}
$transition_properties[$prefix.'transition'][] = $transition_value;
}
$cssp->insert_properties($transition_properties, $block, $selector, $property, NULL);
// Comment the newly inserted properties
foreach($transition_properties as $transition_property => $transition_value){
CSSP::comment($parsed[$block][$selector], $transition_property, 'Added by transitions plugin');
}
}
}
}
}
}
}
/**
* Register the plugin
*/
$cssp->register_plugin('transitions', 'transitions', 'before_glue', 0);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment