Bundling module for NODE.JS

ⅰ亾dé卋堺 提交于 2019-12-22 03:26:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!