Overview of builds
AshKyd opened this issue · 2 comments
Hit enter too soon, excuse me.
I generally have trouble working out which build to use. For the longest time I didn't realise there was a legacy build, and I'm not super sure of the official way to precompile templates for the runtime beacuse there doesn't seem to be mention of the runtime build anywhere.
I think there should be an "overview" or "download" page or the like, that lists all the various builds, an overview of what they do, and links to the relevant documentation because it's super difficult to find. There used to be a really good overview on NPM, but it looks like it's disappeared/I can't find it now.
I'm happy to submit a PR if this makes sense. Perhaps this is a duplicate of #84?
Though the build list can look daunting at first, it's actually pretty simple. A build can be legacy, meaning it supports IE8+, runtime, meaning it does not include the parsing code, or min, meaing it's been compressed.
Half of the files in the build folder are sourcemaps, or files that describe the actual source code, so you can ignore those. The rest are different combinations of the above states! To pick a build, evaluate how you're going to be using ractive, and then choose based on the one that gives you the most functionality for the smallest size. If you're pre-parsing all of your templates for instance, be it on a server or in a build process, you can use runtime, which will save you some kB. If you need to support older browsers, you use the legacy version. If you're not planning on minimizing the file yourself through a build process, then use one of the min versions.
That said, there was an overview on npm, and @Rich-Harris broke it has an issue open for it over at ractivejs/ractive#1899.
As for precompiling templates, there is no "official" way. If you're using grunt, there's grunt-ractive-parse. If you're using gulp, there's gulp-ractive (though that one looks a little outdated). Browserify has a ractiveify transform, and Webpack has a ractive-loader. If you want to do it yourself, there's a guide in the docs for doing it in node.js.
I'm adding the enhancement
label as I agree there should be a good rundown of what the builds are in the docs.
Closing in favor of ractivejs/ractivejs.github.io#64 A list of loaders/tools also available at https://ractive.js.org/integrations/#loaders