简体   繁体   English

NODE.JS的捆绑模块

[英]Bundling module for NODE.JS

ASP.NET MVC 4 has brought amazing tool for bundling multiple stylesheets or javascripts into one like this: ASP.NET MVC 4带来了惊人的工具,可以将多个样式表或javascript捆绑成一个这样的工具:

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? NODE.JS是否有任何模块可以完成相同的任务-将客户端 JavaScript库捆绑为一个? I've seen tools like browserify, uglifier, etc. but these require manual invocation of console commands (or may I have missed something?). 我见过诸如browserify,uglifier等工具,但这些工具需要手动调用控制台命令(或者我可能错过了什么?)。 Meanwhile, it would be nice to eliminate that excessive step and have middleware that could be easily integrated into express.js application, for instance. 同时,最好消除多余的步骤,并具有可以轻松集成到express.js应用程序中的中间件。

有几种尝试实现此目的的方法,您可以尝试一下,看看哪种方法最适合您: bundle-upbrewer.jsconnect-assetmanager

Not to mention automatic complication of stylus files into a single css file, also usable as express middleware. 更不用说将手写笔文件自动复杂化为单个css文件,也可以用作快速中间件。

Search npm for 'asset' and I'm sure you can find tons of these. 在npm中搜索“资产”,我相信您可以找到很多。

You can also try bl-bundler . 您也可以尝试bl-bundler It also supports integration with express.js 它还支持与express.js集成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM