gpt4 book ai didi

javascript - 在 Gruntfile 内部或从 Gruntfile 加载和解析 .ini 文件

转载 作者:行者123 更新时间:2023-11-28 07:11:29 25 4
gpt4 key购买 nike

  • Gruntfile.js 位于项目根/Gruntfile.js
  • asset_compress.ini 位于项目根/app/Config/asset_compress.ini
  • 测试是使用 Jasmine 编写的,规范均位于project root/tests/**/*

以下是一个精简的 Gruntfile。如果您需要更多,请随时询问:

module.exports = function(grunt) {
'use strict';

grunt.initConfig({
jasmine: {
test: {
src: [
'node_modules/jasmine-expect/dist/jasmine-matchers.js',
'app/webroot/js/libraries/jquery-2.0.js',
'app/webroot/js/api/ClassUtility.js',
'app/webroot/js/api/**/*.js'
],
options: {
log: true,
specs: [
'tests/app/webroot/js/api/ClassUtility.spec.js',
'tests/**/*.spec.js'
]
}
}
}
});
};

ClassUtility(及其规范)需要在 API 的任何其他部分之前加载,因为它包含所有其他“类”所依赖的所有内容。这就是为什么它在所有其他 api 类之上专门声明的原因。

但是,我有许多(!)依赖项和许多我需要的其他文件,它们都存在于(相当大的)asset_compress.ini 中。理想情况下,我希望将单个 ini 文件保留为唯一列表,并让我的 Gruntfile 从该列表中读取,以了解它应该加载哪些源文件。

TLDR:如何使用 ini 文件的内容配置 Gruntfile?

最佳答案

正如 bfred.it 所建议的,有很多节点包可以解析 .ini 文件。然而,它们都没有按照我希望的方式工作,所以我决定创建自己的。

源代码、文档、说明以及您可能需要的任何其他内容都可以在这里找到:https://bitbucket.org/skelware/node-file-parser/

随时请求其问题跟踪器上的功能!

关于javascript - 在 Gruntfile 内部或从 Gruntfile 加载和解析 .ini 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31265113/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com