diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-07-30 15:56:29 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-07-30 15:56:29 +0200 |
commit | cbe37079b2519e6a79696ab6525a61498ab3c3a6 (patch) | |
tree | e3df8016eae8883a028762e7a3c48a7e84d9fdd2 /lib/exe/css.php | |
parent | b0df08e2753e34829c2d27f82d25807a4f5bd4b8 (diff) | |
download | rpg-cbe37079b2519e6a79696ab6525a61498ab3c3a6.tar.gz rpg-cbe37079b2519e6a79696ab6525a61498ab3c3a6.tar.bz2 |
convert ini replacements to less vars first
This makes it possible to safely overwrite ini replacements from within
any less file
Diffstat (limited to 'lib/exe/css.php')
-rw-r--r-- | lib/exe/css.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/exe/css.php b/lib/exe/css.php index 04516e8ba..0157e6a40 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -154,6 +154,9 @@ function css_out(){ // apply style replacements $css = css_applystyle($css,$tplinc); + print $css; + + // parse LESS $less = new lessc(); $css = $less->compile($css); @@ -188,15 +191,21 @@ function css_applystyle($css,$tplinc){ $styleini = css_styleini($tplinc); if($styleini){ - $css = strtr($css,$styleini['replacements']); - + // we convert ini replacements to LESS variable names + // and build a list of variable: value; pairs $less = ''; foreach($styleini['replacements'] as $key => $value){ - $key = trim($key, '_'); - $key = '@ini_'.$key; - $less .= "$key: $value;\n"; + $lkey = trim($key, '_'); + $lkey = '@ini_'.$lkey; + $less .= "$lkey: $value;\n"; + + $styleini['replacements'][$key] = $lkey; } + // we now replace all old ini replacements with LESS variables + $css = strtr($css, $styleini['replacements']); + + // now prepend the list of LESS variables as the very first thing $css = $less.$css; } return $css; |