Silverstripe包括JS或CSS文件的变量

I have found on Silverstripe website this custom js programmation :

https://docs.silverstripe.org/en/3.2/developer_guides/templates/requirements/

Requirements::javascriptTemplate("cms/javascript/editor.template.js", $vars);

At the end of the requirements, how $vars must be inserted and is this possible to do the same action to css files?

Please look at the api docs for the information which shows...

if($vars) foreach($vars as $k => $v) {
    $search[] = '$' . $k;
    $replace[] = str_replace("\\'","'", Convert::raw2js($v));
}

$script = str_replace($search, $replace, $script);

So the following array...

$vars = array(
    'iVal'  => '99',
    'iVal'  => "'string'",
);

would transform the following JavaScript...

var iVal = $iVal;
var sVal = $sVal;

to...

var iVal = 99;
var sVal = 'string';