简体   繁体   English

如何一次缩小多个HTML / CSS文件?

[英]How to minify multiple HTML / CSS files at once?

I know I can minify files and concatenate them one by one before production, but that sounds like a tedious way to do it. 我知道我可以在制作前逐一缩小文件并将它们连接起来,但这听起来像是一种单调乏味的方法。

Is there some way to minify all my files before pushing it to production? 有没有办法在将其推送到生产环境之前缩小所有文件?

I am using NodeJS, with JS, CSS, and html. 我正在使用NodeJS,JS,CSS和HTML。

I found this not sure if there is a better way or the answer: https://github.com/srod/node-minify 我发现这不确定是否有更好的方法或答案: https//github.com/srod/node-minify

Thanks 谢谢

You'll need to setup a build-tool or task-runner / or both. 您需要设置构建工具或任务运行器/或两者。

If you are using Node (you know JavaScript) - but you are new to build tools, you may want to start with Gulp . 如果你正在使用Node(你知道JavaScript) - 但是你是新手来构建工具,你可能想要从Gulp开始。 The website should walk you through it. 该网站应引导您完成它。 Webpack is pretty complex. Webpack非常复杂。 I use Brunch and Broccoli and sometimes - when I need an easy to use GUI, CodeKit. 我使用早午餐和西兰花,有时 - 当我需要一个易于使用的GUI,CodeKit。 There are lots of options. 有很多选择。 Learn Gulp and then you'll be in a good spot to think about other ways and their positives and negatives. 学习Gulp,然后你会在一个好地方考虑其他方式及其积极和消极。 Good Luck! 祝好运! : ) :)

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

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