In My coldBox app I have shared code and client specific code. I espetially looking for css and js. So I have shared code that I share througth Virtual directory in IIS.
I have the interceptor which determine which Layout get what css AND js. (shared code). The problem is that each client may have its own css how can I accomplish this scenario.
In each application you can simply add the addAsset code in your handler and this should populate the tag dynamically. This assets could be stored in your IIS path (/JS/) or your local app path (/includes/js/)
I do use addAsset in my loadRenderProperties function. And Layout is using properly. I also Create a virtual directory for /includes where I have my js and css.
But the problem IS if I am in my new app for example would l like to apply a new style sheet my interceptor is not happening
There are a number of ways you can do this, but the most common approach that I have used is dependent on how you have designed your application.
So here is the question that we would need to ask you, how is this setup. Is the core application shared across all the domains you are using or do you just want one part of the code shared.
In the past I have used a core application code that is shared amongst all the domains that I have, I then in the application.cfc use code to identify which database will then be used and then set the application name to reflect this. From here you can then use an interceptor or other means to then lock what gets accessed.
In my case I also use a skin system that not only defines the look and feel for each site, but I also use different handlers views that are then based on that skin. This achieves two things, the first is that it keeps code that shouldn’t be shared such as CSS/JS files although there are times when these can be shared as well. So I have a common area that these can be loaded from in the normal shared application and the views for each skin, this was designed well before the introduction of modules and can still apply to core code in this method as well.
The concept here is that when the application is requested the url is checked, then the external locations are then changed to reflect the code aka handlers, etc to be loaded. I have been meaning to blog about this for a year or so now but never got around to doing that, but I would be happy to share more on how I do it.
I think there is a post in here explaining more on how I did this, although it might be about 12-16 months old the principle is still the same.
SO I got addAsset to work now the problem is foolow. My shared includes I reference in by creating a virtual directory, but my local css file can not be found because it is trying to use virtual directory to find that file . What should I do ?
With the way I do it, it doesn’t require a virtual directory. But it also assumes that all the domains will use the same core application code, and that is your core application and not ColdBox itself.
with my layout I have under shared folder styles directory. The same directory I have in client . SO in order for me to use includes from shared I set the virtual directory on the server. So now I can not see my styles