项目作者: exiguus

项目描述 :
Node.js Grunt Config Helper Class to Help with Grunt configs and tasks.
高级语言: HTML
项目地址: git://github.com/exiguus/js.node.grunt.config.helper.git
创建时间: 2018-05-05T15:44:32Z
项目社区:https://github.com/exiguus/js.node.grunt.config.helper

开源协议:MIT License

下载


tests
![coverage][coverage]
![maintainability][maintainability]

js.node.grunt.config.helper

Node.js Grunt Config Helper Class to Help with Grunt configs and tasks.

npm

npm

  1. npm install --save-dev js.node.grunt.config.helper

Example

Extend Grunt Config Jit Environment

Using the Extend functionality in a jit-grunt Environment like:

  1. Project/
  2. |build/
  3. | |helper/
  4. | |_grunt/
  5. | |task_name/
  6. | | |tasks1.js
  7. | | |tasks2.js
  8. | |task_name.js
  9. |Gruntfile.js

Extend task_name.js with task1.js and task2.js from task_name/ directory.
task_name.js filename must be the task name of the Grunt Plugin.

  1. // task_name.js
  2. module.exports = function() {
  3. const path = require('path');
  4. const GruntConfigHelper = require('js.node.grunt.config.helper');
  5. const requireDirectory = path.resolve(__dirname, 'task_name');
  6. const extendConfigHelper = new GruntConfigHelper(requireDirectory);
  7. const tasks = extendConfigHelper.getTasks();
  8. };

Extend Grunt Config in standard Gruntfile.js Environment

Using the Extend functionality in a standard Grunt Environment:

  1. Project/
  2. |build/
  3. | |helper/
  4. | |_grunt/
  5. | |task1.js
  6. | |task2.js
  7. |Gruntfile.js

Extend Gruntfile.js with task1.js and task2.js by filename.
task1.js and task2.js filename must be the task name of the Grunt Plugin.

  1. // Gruntfile.js
  2. module.exports = function (grunt) {
  3. const path = require('path');
  4. const GruntConfigHelper = require('js.node.grunt.config.helper');
  5. const requireDirectory = path.resolve(__dirname, 'build/helper/_grunt');
  6. const extendConfigHelper = new GruntConfigHelper(requireDirectory, true);
  7. const tasks = extendConfigHelper.getTasks();
  8. // Project configuration.
  9. grunt.initConfig({
  10. tasks, // {task1: {...}, task2: {...}}
  11. ...
  12. })
  13. ...

Documentation

jsDoc

[coverage]:
https://api.codeclimate.com/v1/badges/017792a8149e03c3f71b/test_coverage

[maintainability]:
https://api.codeclimate.com/v1/badges/017792a8149e03c3f71b/maintainability