Resource Sets - How to use them?

Oct 26, 2012 at 3:02 AM

I originally requested this feature a while back. I just tried using them in one of my sites, and I think I am doing something wrong. 

For example, I have jquery-1.8.2.min.js, and bootstrap.js in use on every single page of my site. They are also two of the biggest scripts i use in the site. Other pages o nthe site use various other scripts which are small. What I want to happen is for Combinator to bundle jquery + bootstrap together, and every page that needs either jquery, or bootstrap (or both), Combinator serves the two combined (based on the existence of the resource set I declared). Any other scripts referenced from a page get bundled using the default Combinator logic. 

Is the above possible with this module? What I tried was to enter a line in the Combinator config:


but with the above setting jquery.js and bootstrap.js are served as standalone .js files (with the hashed file name that Combinator makes), and the rest of the scripts are bundled into a combined one. So I actually end up with more script includes than if I hadn't used the resource sets. 


Oct 26, 2012 at 1:42 PM

Yes, this is possible and you're doing it right: as hints on the UI say, you can declare one set per line, so indeed here jQuery and Bootstrap is in the same set. However, sets only work correctly (due to the dependency between resources) if the resources in the same set are included after each other after the calculation of dependencies, i.e. how is it (without Combinator) written to the markup. So here this set can only work correctly if the jQuery and Bootstrap js files are normally included after each other, without anything else between them.