Last active
September 19, 2015 14:29
-
-
Save da411d/81c80603ebd6cc952eef to your computer and use it in GitHub Desktop.
CSS Pre-processor
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
function preprocessor($text){ | |
$parts = explode("~~~~~~~~~~~~~~~~", $text); | |
$parts[0] = str_replace("\n",'',$parts[0]); | |
$parts[0] = str_replace("\r",'',$parts[0]); | |
$param = explode(";", $parts[0]); | |
$style = $parts[1]; | |
$params = []; | |
foreach($param as $p){ | |
if($p){ | |
$params[] = explode(" = ", $p); | |
} | |
} | |
foreach($params as $p){ | |
if($p){ | |
$style = str_replace($p[0], $p[1], $style); | |
} | |
} | |
return $style; | |
} | |
$style = file_get_contents('style.css'); | |
$style = preprocessor($style); | |
echo $style; |
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
body{ | |
background:#000; | |
font-family: Arial; | |
letter-spacing: 1px; | |
font-size:150%; | |
color:#fafafa; | |
cursor:default; | |
margin:0px; | |
} |
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
_theme_bg_color_ = #000; | |
_theme_text_color_ = #fafafa; | |
~~~~~~~~~~~~~~~~ | |
body{ | |
background:_theme_bg_color_; | |
font-family: Arial; | |
letter-spacing: 1px; | |
font-size:150%; | |
color:_theme_text_color_; | |
cursor:default; | |
margin:0px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment