Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow multiple chunks of compressed script? #29

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

allow multiple chunks of compressed script? #29

sauravshah opened this issue May 17, 2012 · 11 comments

Comments

@sauravshah
Copy link

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
Copy link
Owner

dirkmc commented May 17, 2012

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

@sauravshah
Copy link
Author

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
Copy link
Owner

dirkmc commented May 17, 2012

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
Copy link

cmicali commented Sep 15, 2012

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
Copy link
Owner

dirkmc commented Sep 15, 2012

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

@cmicali
Copy link

cmicali commented Sep 15, 2012

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
Copy link
Owner

dirkmc commented Sep 15, 2012

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
Copy link

cmicali commented Sep 15, 2012

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

@dirkmc
Copy link
Owner

dirkmc commented Sep 15, 2012

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
Copy link

cmicali commented Sep 15, 2012

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
Copy link
Owner

dirkmc commented Sep 15, 2012

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants