DO you think that the virtula can cause the problem. Because cutomclient.css only exists on the client folder. And all others are referenced by virtual directory
My content decorator looks like this
/** Request Context Decorator enhances and augments the EVENT object for our ColdBox applications. */
component
name = ‘RequestContextDecorator’
extends = ‘coldbox.system.web.context.RequestContextDecorator’ {
public void function configure () {
// Prepare our data structure to
// hold and organize assets such as JavaScript/CSS
buildAssetScaffold();
return;
}
/** Allow assets to be loaded into the queue */
public void function addAsset( required string path
,string method=‘queue’
,boolean fullPathProvided = false
,string template = ‘Layout.Default.cfm’) {
// Grab the Request Context from within the Event Object
var prc = getRequestContext().getCollection(private = true);
// Organize by the file extention
var type = listLast(path, ‘.’);
// Replace the following with the relative directories from your
// web root
if (!fullPathProvided)
path = (type == ‘css’)
? ‘/includes/styles/’ & path
: ‘/includes/javascript/’ & path;
// Prevent duplicates
if (!structKeyExists(prc.assets[method],’#template#’) )
structInsert(prc.assets[method],’#template#’,{js = [], css = []},“true”);
// TODO: add functionality to make the type inserts dynamic , so probably need to check for sub-struct existence
if (!arrayContains(prc.assets[method][’#template#’][type], path))
arrayAppend(prc.assets[method][’#template#’][type], path);
return;
}
/** Allow multiple assets to be loaded into the queue */
public void function addAssets(required string paths
,string method = ‘queue’
,boolean fullPathProvided = false
,string template = ‘Layout.Default.cfm’) {
var list = listToArray(paths, ‘,’);
// Add each path individually
var n = arraylen(list);
var i = 0;
for (i=1; i <= n; i++)
addAsset(path=trim(list[i])
,method=method
,fullPathProvided=fullPathProvided
,template=template);
return;
}
/** Allow assets to be returned from the queue */
public array function getAssets(required string type
,string method = ‘queue’
,string template = ‘Layout.Default.cfm’) {
var prc = getRequestContext().getCollection(private = true);
var pulledAssets = [];
if (structKeyExists(prc.assets[method][template],’#type#’) )
pulledAssets = prc.assets[method][’#template#’][type];
return pulledAssets;
}
/** Allow assets to be returned from the queue */
public void function clearAssets() {
buildAssetScaffold();
return; ;
}
// Private ----------------------------------------------------------------------
/** Used to help construct the foundation to manage assets. */
private void function buildAssetScaffold() {
var prc = getRequestContext().getCollection(private = true);
prc.assets = {};
// The queue allows the assets to be include by template into the page.
prc.assets.queue = {};
// The queue allows the assets to be include by path into the page.
prc.assets.queue = { template = { js = [], css = [] } };
// Includes allow the content of an asset to be injected into the page.
prc.assets.include.js = [];
return;
}
}
My template helper looks like this.
var rc = event.getCollection();
var prc = Event.getCollection(private=true);
Event.addAssets(paths=’
customClient.css’
);
Event.addAssets(paths=’
http://xxx.xxxxxxx.com/includes/styles/customClient.css’,
template = ‘Layout.Login.cfm’,
fullPathProvided = true
);