How does Combinator generate the file name for the combined resources?

Jan 9, 2012 at 4:09 AM

I'm guessing it's based on the file contents (e.g. hash of file contents), but just wanted to make sure. Will the same set of input scripts always result in the same combined .js or .css file name? 

Jan 9, 2012 at 12:21 PM

It's the hash of the concatenated file names of the set's files, so yes, given a set of files (in case of JS, with the same locations), the file name will also be the same.

Feb 15, 2012 at 11:09 PM
Edited Feb 15, 2012 at 11:13 PM

Well, in our case it keeps regenerating new files for every request.

Maybe because I include 1 js with a 'rnd' attached. Ofc it should differ then when combining BUT I excluded this 'dynamic' js so it shouldn't affect the generated js filename.

edit: Fixed by using Script.Head() {} instead of Script.Include()

edit2: Guess not.. I also use Script.Require on 2 scripts that need to be loaded AFTER my dynamic js is loaded and loading that using Script.Head puts things in the wrong order :(

Feb 16, 2012 at 9:14 AM

This happens because Combinator identifies a set of resources for a page with the sum of their urls. This is an early step, so exclusions don't affect this.

The following could be a solution: I can change Combinator so that the resources' name is used instead of the url, which I think should be unique across resources too. I guess you're setting the rnd parameter in a view. Now if you include a script with Script.Include() (which is kind of an anonym resource), that won't work as then the url is also the name of the resource. But if you define the script in a ResourceManifest with a name (which also gives you a fine control over in what order resources are included by the ability of defining dependencies) that would cut it: you'd have to override the resource's url dynamically in the view as follows:

Script.Require("name").InlineDefinition = (definiton) =>
Would that work for you?