问题
ASP.NET MVC 4 has brought amazing tool for bundling multiple stylesheets or javascripts into one like this:
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.theme.css"));
Does NODE.JS have any modules to fulfil the same task - to bundle client javascript libraries into one? I've seen tools like browserify, uglifier, etc. but these require manual invocation of console commands (or may I have missed something?). Meanwhile, it would be nice to eliminate that excessive step and have middleware that could be easily integrated into express.js application, for instance.
回答1:
There are several attempts to implement this, you can try them out and see which works best for you: bundle-up, brewer.js, connect-assetmanager
回答2:
Not to mention automatic complication of stylus files into a single css file, also usable as express middleware.
Search npm for 'asset' and I'm sure you can find tons of these.
回答3:
You can also try bl-bundler. It also supports integration with express.js
来源:https://stackoverflow.com/questions/14027710/bundling-module-for-node-js