linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

generated/js/vendor.js and generated/js/app.js #334

Closed peterbe closed 9 years ago

peterbe commented 9 years ago

At the moment, lineman run generates generated/js/app.js which is nice. It contains all the vendor/_.js and all the app/_/.js into one massive file.

I would like to split that up so it generated two files instead (so my index.us would have two <script> tags). How is this possible?

My goal is to be able to limit coverage analysis to exclude things like generated/js/vendor.js and I suspect that when going into production my dist/js/vendor.js will less likely change over time but dist/js/app.js will more frequently.

Also, I think the browser could benefit from downloading and parsing two files simultaneously.

searls commented 9 years ago

Lineman doesn't support multiple bundles. We've discussed this but it hasn't proved worthwhile to us yet, and almost every instance where people have wanted it, it's been for suspect reasons

On Wed, Nov 12, 2014 at 1:52 PM, Peter Bengtsson notifications@github.com wrote:

At the moment, lineman run generates generated/js/app.js which is nice. It contains all the vendor/_.js and all the app/_/.js into one massive file. I would like to split that up so it generated two files instead (so my index.us would have two <script> tags). How is this possible? My goal is to be able to limit coverage analysis to exclude things like generated/js/vendor.js and I suspect that when going into production my dist/js/vendor.js will less likely change over time but dist/js/app.js will more frequently.

Also, I think the browser could benefit from downloading and parsing two files simultaneously.

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/334

peterbe commented 9 years ago

"suspect reasons" ?? :)

I think being able to NOT do coverage analysis on angular would be useful. And parallelizing downloads would be useful too.

If it would be hard to do I'm fine with that.

searls commented 9 years ago

I think @davemo will chime in on happy cases

But in practice, usually when people want to build to multiple JS targets, it's because something about the way they're writing JavaScript precludes it all from being loaded simultaneously.

On Wed, Nov 12, 2014 at 2:15 PM, Peter Bengtsson notifications@github.com wrote:

"suspect reasons" ?? :) I think being able to NOT do coverage analysis on angular would be useful. And parallelizing downloads would be useful too.

If it would be hard to do I'm fine with that.

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/334#issuecomment-62775818

davemo commented 9 years ago

I'm :+1: on this feature @peterbe, if anything it should be the default (at least optional via some config setting) due to the fact that a split between vendor.js and app.js is the lowest common denominator with respect to caching granularity.

The benefits you mention on exempting the vendor libs from static analysis tools is another benefit; would you be interested in submitting a PR for this feature @peterbe? We'd be happy to review and merge if it works out :)

peterbe commented 9 years ago

The benefits you mention on exempting the vendor libs from static analysis tools is another benefit; would you be interested in submitting a PR for this feature @peterbe? We'd be happy to review and merge if it works out :)

I would be interested but it's realistically not going to happen any time soon. I have a lot to learn still.

jayharris commented 9 years ago

We have done this to Lineman several times. Not just for caching and analysis, but some of the frameworks we use (like SignalR) want to inject a server-generated dynamic script in between Vendor and App.

I also :+1:

peterbe commented 9 years ago

Hehe When I load up coverage/lcov-report/js/app.js.html my whole browser stutters and shivers. It's because app.js has ~25,000 LOC :)

davemo commented 9 years ago

Hey @peterbe and @jayharris, I just released lineman-vendor-split which should help with this. Try it out and let me know if it works for you :) https://github.com/linemanjs/lineman-vendor-split