Assume you have the following:
$conf['base_width'] = 10 ;
CSS::setConf($conf) ;
$css = CSS::load("myfile") ; // Assumes .css, you provide full path.
myfile.css
----------------------------
.classname1 {width: [base_width]px ; }
.classname2 {width: [base_width * 2]px }
would be translated to:
.classname1 {width: 10px ; }
.classname2 {width: 20px }
If you do fractional maths, and want the result to be integer, you can prepend the variable name by ~, performing a floor, such as:
.classname1 {width: [base_width]px ; }
.classname2 {width: [~base_width * 1.55 + 2]px } (10*1.55 + 2 = 17.5)
translating into:
.classname1 {width: 10px ; }
.classname2 {width: 17px }
|