That discussion aside, you can still argue that requiring all the files
explicitly instead of implicitly is a win. Then you have an opportunity to
think if a file should or not go into a specific manifest.
Also, it makes it easier to understand which files are loaded and in which
order.
Best,
Brian-
You raise some great points and are moving into some bigger picture stuff about
how one actually writes Javascript.
In general (although there are some exceptions), having one large concatenated
JS file, properly GZIPed, pushed to an asset bucket (like Amazon), pulled from
a CDN (like
For sure, but it would be a relatively small file, wouldn't it? There's a
lot of (reasonable) concern about making multiple HTTP requests, but that's
usually when you're evaluating the performance of a single page. As you go
between pages you'd be just loading what you need.
Honestly it might
Brian,
I think require_tree often leads to problems (it’s one of the first things I
remove when I’m building an app), but by loading specific JS files per page,
aren’t you denying your users’ browsers the opportunity to cache the JS from
other page visits? Separate per-page JavaScript files m
I posted an issue about this
( https://github.com/rails/rails/issues/17457#issuecomment-61292491 ) but
I'll copy/paste here for discussion convenience:
I feel like I'm the boy telling the emperor he has no clothes, but here
goes...
Every large rails project that I've worked on has had it's ap