allow multiple chunks of compressed script? #29

Open
sauravshah opened this Issue May 17, 2012 · 11 comments

3 participants

@sauravshah

I want to combine 2-3 different scripts into one file and the rest into another. Does not seem possible with press right now and I seem to end up with one monolithic js file.

@dirkmc
Owner

It sounds like maybe the greenscript plugin would be better for your needs?

@sauravshah

Does greenscript allow this?
Greenscript is too bulky for my use though - too many features that I don't really need and the syntax is complicated enough to cause issues.

@dirkmc
Owner

I haven't looked at it for a while, you'd need to check the documentation to see if it's possible. Press is designed to be as simple as possible; at present you can create individually compressed files and a single aggregate file, but you can't divide files into groups to be aggregated.

@cmicali

It would be great to add this - for example, just add a 'key' parameter to #{press.script} which specifies which group the file is added to.

This would be very helpful in my case where i have ~20 common JS files and then 1-2 specific files per-screen. Without the groups the initial 20 will have to be re-downloaded once for each page, negating a lot of the speed benefit gained by using press.

@dirkmc
Owner

Yeah I see what you're saying, let me think about the best solution to that problem

@cmicali

Thanks! I did re-read the docs and noticed it sounds like the generated filenames are based off of the target URL, so for this to work completely maybe that would also have to change to only reflect the files being combined - that way if two pages referenced the same set of JS not only would the press backend use it's cache but the browser cache could work too because the generated filename wouldn't change.

Either way, great work on this module - it's as easy to use as the LESS one (drop-in and it just works) and vastly simpler than greenscript.

@dirkmc
Owner

Actually have you tried adding the files using #{press.single-script 'file.js' /}? You may find that it's actually faster than having the files aggregated into groups, because the browser will download them in parallel (it will cache them so they won't be re-downloaded for each page)

@cmicali

That's what I'm doing now - seems fine if the # of page-specific files stays low.

@dirkmc
Owner

Ok great. The idea with press was to try to make it as simple as possible, with nothing for the user to really think about, just change the tag name and it should do everything automatically for you. That's why I'd prefer not to introduce any complicating features if possible.

@cmicali

Yeah, totally understand, and that's one of the things that makes press great.

I'll see if I can get any performance #s when we move this to production to gauge if there is a compelling enough reason to consider this.

@dirkmc
Owner

Cool, let me know what you find

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment