丑化目录
有没有办法告诉 uglify 获取整个目录并输出到 1 个 script.js 文件中,而不是单独将代码和文件添加到 uglify 脚本中?
Rather than adding code and files to the uglify script individually, is there any way to tell uglify to grab an entire dir, and output into 1 script.js file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果 uglifyjs 你的意思是 https://github.com/mishoo/UglifyJS 这有效!如果没有输入文件,
uglifyjs
将从STDIN
读取。If by uglifyjs you mean https://github.com/mishoo/UglifyJS this works! Without an input file
uglifyjs
will read fromSTDIN
.请注意,脚本的加载顺序可能很重要。因此,上面的代码可能会失败(因为它只是按照
find
返回文件的顺序转储文件)。我建议您编写一个为您的应用程序定制的小型 shell 脚本。Note that the load order of your scripts might be important. The above could therefore fail (as it just dumps the files in whatever order
find
happens to return them). I would suggest you to write a small shell script customized for your application.您可以使用 uglifyjs-folder 模块来实现这一点。它还支持单独处理它们(不合并在一起)。
https://github.com/ionutvmi/uglifyjs-folder
https://www.npmjs.com/package/uglifyjs-folder
You can use
uglifyjs-folder
module for that. It also supports processing them individually (no merging together).https://github.com/ionutvmi/uglifyjs-folder
https://www.npmjs.com/package/uglifyjs-folder
https://github.com/balupton/buildr.npm 也可能有帮助
https://github.com/balupton/buildr.npm may also be helpful
我参加聚会迟到了,但我发现 Igneous 非常方便。它按照它所说的去做,而不施加额外的限制或哲学。
I'm late to the party, but I found Igneous to be very convenient. It does what it says without imposing additional constraints or philosphies.