How to tame Resource Sets?

Jul 9, 2015 at 11:30 AM

I'm trying to make use of combinator, but so far without luck, it's actually decreasing my performance now. I have 7 script resources that are included on every page as they are included in theme's document.cshtml, I would like them to be one single resource set and if page includes anything else then that should be second resource set (placed after the first as first includes jQuery). Can I achieve this behavior?

Those 7 resources are defined in theme's Resource Manifest and have chain dependency on each other. So I have just Script.Require("ThemeJS") ... If i input ThemeJS into resource sets nothing happens. Should I specify resource name, or file names? I'm lost here :) Thanks.
Jul 9, 2015 at 12:13 PM
Yes, by configuring either the first or the second set of resources to be matched by the resource set regex you can achieve this: e.g. if you know that the common resources in the first set are always script1.js and script2.js then by configuring a resource set regex "script1.js|script2.js" these scripts will be in their own set (and anything else will be in another one).

As mentioned on the settings editor the full public URL of the resources is used for pattern matching.

Also make sure you use the latest source of Combinator from here, not the Gallery version.
Jul 9, 2015 at 2:33 PM
Edited Jul 9, 2015 at 2:34 PM
Thanks for prompt reply. Yup I'm using latest from the dev branch. It's better now, I'm still facing 2 issues.

1) Almost all resources both styles and scripts that are generated by combinator come with duplicates. In /Media/Default/_PiedoneModules/Combinator/Styles after single page visit i get -1271634694-1.css and 1583750745-1.css they are binary identical and only one is included on the page, is this deliberate behavior?

2) On one page I have module which is including script defined in it's resourcemanifest with dependency on jQuery. This is breaking my defined resource set, it removes jQuery from the existing set (so it creates new one without jQuery), creates another set just for jQuery and then another set for rest of the page scripts. So on that page I have 3 new resource sets. Is there a way to prevent jQuery being singled out without removing the dependency on it from the module's resource manifest?
Jul 9, 2015 at 2:45 PM
1) This is not deliberate, I don't know why this happens.
2) I guess this is happening because the new script changes the order in which scripts are included: resource sets only work if the resources in the set are included directly after each other; if something gets between them then the set will be broken up. This is because the order of scripts/stylesheets represents dependencies between them and Combinator can't do anything to change the order without the risk of breaking something.
Jul 9, 2015 at 3:29 PM
Pretty much every script on that page depends on jQuery, it's the script that is always first, on every page. I resolved that by excluding it from the combination, I'll let it load separately from some CDN. Probably better solution anyway.

These duplicates I will have to watch out for, that page that adds own scripts recreated the theme resource set once again, but it's not using it ... All pages are loading same files as they should, but for some reason extra unused files are generated. It's no big deal I crawled the entire site and ended up with 5 files instead of 2. I'll try to find the culprit when I have more time.

Thank you again for your assistance :).
Jul 9, 2015 at 3:31 PM
Glad and do come back if you find the issue. I've never seen it.