全局排除某个文件?
Glob to exclude a certain file?
尝试使用分别位于输出文件顶部和底部的页眉和页脚脚本编译我的项目。在它们之间,我想在项目中包含所有其他脚本,包括递归地进入子文件夹。
我试过了 "..\script\header.js" "..\script\**.js" "..\script\footer.js"
页眉显示在顶部就好了,但页脚最终出现在中间的某个地方。有什么方法可以从中间 glob 中排除页脚文件,以便它只附加到末尾?
编辑:运行 使用以下命令从 windows 中的 cmd 编译器:
java -jar closure.jar --compilation_level "WHITESPACE_ONLY"
--create_source_map "source-map" --output_manifest "manifest"
--output_wrapper_file "output" --js_output_file="..\script.js"
"..\script\header.js" "..\script\**.js" "..\script\footer.js"`
编译器本身会处理排除 glob。有几个选项可以强制排序:
Use dependency management。通过使用 CommonJS 或 ES6 模块或使用 Closure-library 的 goog.require
和 goog.provide
调用,编译器可以为您自动排序输入文件。
拆分您的文件,这样您就可以构建一个不包含您的 footer.js
文件的 glob。
使用理解否定 globs 的 pre-build 工具来处理您的源文件集。
尝试使用分别位于输出文件顶部和底部的页眉和页脚脚本编译我的项目。在它们之间,我想在项目中包含所有其他脚本,包括递归地进入子文件夹。
我试过了 "..\script\header.js" "..\script\**.js" "..\script\footer.js"
页眉显示在顶部就好了,但页脚最终出现在中间的某个地方。有什么方法可以从中间 glob 中排除页脚文件,以便它只附加到末尾?
编辑:运行 使用以下命令从 windows 中的 cmd 编译器:
java -jar closure.jar --compilation_level "WHITESPACE_ONLY"
--create_source_map "source-map" --output_manifest "manifest"
--output_wrapper_file "output" --js_output_file="..\script.js"
"..\script\header.js" "..\script\**.js" "..\script\footer.js"`
编译器本身会处理排除 glob。有几个选项可以强制排序:
Use dependency management。通过使用 CommonJS 或 ES6 模块或使用 Closure-library 的
goog.require
和goog.provide
调用,编译器可以为您自动排序输入文件。拆分您的文件,这样您就可以构建一个不包含您的
footer.js
文件的 glob。使用理解否定 globs 的 pre-build 工具来处理您的源文件集。