Including Js Files From Within Js Files
I’m working on an application which stores a lot of data in the application scope. Part of the data stored is a config CFC that has a method which loads ‘external assets’ (javascript and css files etc) into the
of the html document viaMy part in this application development is limited to a particular section only, but there was already a lot of external assets present in the header and things were getting very messy. I was looking for a way to simulate
I now have a master js file to add to the
section of my document:1
| |
From within this master.js file I can ‘include’ any js files I want.
master.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
The above code includes myFile1.js and myFile2.js, both of which are located in the relative ‘js/’ directory.
Not only does this clean up my output, but as my config file was stored in application scope every time I wanted to add/remove an asset from my application I need to refresh the scope…annoying. But now I am happy :)