3 ms·
>> r.js has an inflexible build process. It tries to do everything and assumes you want it to be your only build tool, which fails with things like LESS files,
by nilliams 14y ago
>> r.js has an inflexible build process. It tries to do everything and assumes you want it to be your only build tool, which fails with things like LESS files, custom image generation etc.
I'm not sure I agree with that. I use r.js just for building my JavaScript. I just point it at my main.js and voila I get a main-built.js.
I'm not sure how it stops you from using other tools like LESS to deal with stylesheets and pulling these steps together however you want. For instance my build.sh script is 4 lines, a call to r.js for my JS, a call to handlebars to precompile my templates, a call to uglifycss for my styles, and then a call to a tiny Node script which generates my index.html in either dev or production mode. I don't feel like r.js is dictating by build process at all. (PS, I am aware I should probably check out Grunt!).
>> browserify does its bundling and lets you do the rest in your own build system of choice (even minifying is separate). Much better.
With r.js you can set optimize: "none" [1] (in build config or on the command line) and then it won't minify it for you. You can then minify as a separate step if you wish.
[1] http://requirejs.org/docs/optimization.html#turbo http://requirejs.org/docs/optimization.html#turbo
- spion 14y agor.js tries to pull all the files in the base path and copy them to the build path by default. It also pulls the less files, non-built images - pretty much everything, and mirrors it exactly at the build path. How to turn this off? I suppose its the appDir option - or is it? With require.js's documentation and the confusing option names, who knows... If its appDir, why isn't it called something saner like copyPaths that actually indicates what its going to do rather than assuming I'm familiar with its notion of "appDir"? It all probably comes down to these two points: * require.js options are confusingly named, and * the documentation is convoluted and conflates explanations of multiple options at once
- nilliams 14y agoOh, now I'm with you. I guess I've never tried that kind of build, in fact maybe I found a lucky vector into the optimizer the first time I came across it, as I now see if you read the optimizer docs from top to bottom it does initially guide you towards the whole dir approach. Maybe the optimizer/r.js docs could do with splitting up into "how do I do X..." pages, so if you're purely after optimizing your JS, for example, the path is clearer.