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

Optimize for production #14

Open
KP opened this issue Aug 7, 2014 · 5 comments
Open

Optimize for production #14

KP opened this issue Aug 7, 2014 · 5 comments

Comments

@KP
Copy link

KP commented Aug 7, 2014

Ractive.load is awesome for development. It's less than ideal for production because each component is retrieved through an individual request. Are there any thoughts on how we could have the best of both worlds:

  1. Easy, modular components in development
  2. A single request for all templates in production
@MartinKolarik
Copy link
Member

You can use this plugin for browserify or instead of ractive load use RVC with RequireJS. The second option might be a bit easier.

@Rich-Harris
Copy link
Member

The browserify/require/broccoli loaders will always be the 'best' way to use components in production (since they can optimise stuff, and mean you can use the slimmer runtime version), but I'm actually strongly in favour of this idea. I think bundling a set of components into a single file brings ractive-load into 'good enough for production' territory, and if people are spared the cognitive burden of dealing with RequireJS et al then we've done a good thing for humanity.

The Polymer project has vulcanize; we could have something similar. Perhaps this should be handled by a general command line tool (see ractivejs/ractive#485 for a previous discussion), since there are other tasks that ractive-cli could handle if such a thing existed.

@MartinKolarik
Copy link
Member

@Rich-Harris What I meant was that you should be able to use ractify exactly for that. Use ractive load during development and create an all-in-one file for production. And since it's a plugin for browserify, you can also add JS code.

Not against a command line tool, just saying.

@parhelium
Copy link

@Rich-Harris I have created example app which uses ractive and ractive-load with 3 components.

How can I bundle a set of components into a single file and then still use ractive-load in production ?

@Rich-Harris
Copy link
Member

@parhelium Right now it's not possible I'm afraid - you would have to use rvc with RequireJS, ractify with Browserify, or broccoli-ractive with Broccoli (though broccoli-ractive only converts them to modules, they still have to be bundled somehow). Hopefully we can make a start on that CLI tool soon, and then you'll be able to do something like this:

ractive compile components/Main.html > bundle.html

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

4 participants