英文:
Npm scripts - how to minify files from a folder and save them into another?
问题
我正在使用npm脚本来编译和压缩sass和可能的javascript文件。但是,我正在寻找一种指定*.js
文件的源文件夹并将它们逐个(不合并)压缩并保存在目标文件夹中的方法,每个文件保存为*.min.js
。
我尝试过使用npm terser,但似乎不能处理源文件夹,只能处理单个文件,而且似乎也不能逐个压缩文件。
所以,我正在寻找:
Src/
|__main.js
|__menu.js
|__等等...
Dist/
|__main.min.js
|__menu.min.js
|__...
我应该使用哪个npm包来实现这个目标?
英文:
I'm using npm scripts to compile and minify sass and potentionally javascript files.
However, I'm looking for at way to specify a source folder of *.js
files and have them minified and saved in a destination folder individually - (flattened, not concatenated) each as *.min.js
.
I have tried with npm terser, but it doesn't seem to be able to with with a source folder, only single files, nor does it seem to be able to minify the files individually.
So, what I'm looking for:
Src/
|__main.js
|__menu.js
|__etc...
Dist/
|__main.min.js
|__menu.min.js
|__...
Which npm package should I use for this?
答案1
得分: -1
So, it seems that the package Terser folder can do just this...
英文:
So, it seems that the package Terser folder can do just this...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论