teamcfadvance / cfstatic

CfStatic is a framework for managing the inclusion and packaging of CSS and JavaScript in CFML applications.
https://teamcfadvance.github.io/cfstatic
MIT License
102 stars 35 forks source link

ER: use include calls to determine file order #2

Closed aliaspooryorik closed 12 years ago

aliaspooryorik commented 13 years ago

Hi, Just trying out cfstatic for the first time on an existing site. I don't have any dependency information in the css / js files so thought that if I did:

    beanFactory.getBean( "cfStatic" ).include('assets/js/jquery-1.5.1.min.js')
        .include('assets/js/jquery.hoverIntent.min.js')
        .include('assets/js/jquery.tools.min.js')
        .include('assets/js/common.js')
        .include('assets/js/jquery.lightbox-0.5.min.js');

Then it would be cool if cfstatic preserved the order they are passed in when rendering.

Thanks!

DominicWatson commented 13 years ago

Nice idea, I'll have a look to see how doable it is...

DominicWatson commented 13 years ago

At a quick glance it looks like it'll be quite a rewrite. Defo a good idea though, will mill it over for the next version.

p.s. if common.js had dependencies on all the others, you could just do:

beanFactory.getBean( "cfStatic" ).include('assets/js/common.js')

aliaspooryorik commented 13 years ago

Ah top tip - thanks Dominic!

DominicWatson commented 13 years ago

On another note, unless you are using minifyMode="file", all those javascript files will be concatenated into to a single file (because they all sit in the same folder). Including any one of those individual files with 'include()' will result in that single minified file being included. This, indeed, is the reason that the @depends markup needs to be there; CfStatic needs to know upfront what order your files need concatenating in when generating the min files.

DominicWatson commented 12 years ago

Closing this - I don't this should be implemented as it leads users down a confusing path. The depends are there for good reason - having two methods of defining sort order should be avoided I think.