0.1.1 • Published 12 years ago

grunt-var-utils v0.1.1

Weekly downloads
1
License
-
Repository
bitbucket
Last release
12 years ago

grunt-var-utils

Utils for common variable usages.

Getting Started

This plugin requires Grunt 0.4.x

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-var-utils --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-var-utils');

The "var_utils" task

Overview

In your project's Gruntfile, add a section named var_utils to the data object passed into grunt.initConfig().

grunt.initConfig({
  var_utils:{
    options: {
       includeJS: true
      ,includeSCSS: true
      ,addCommonConfigVars: true
      ,addCommonAngularJSConfigVars: true
    },
    a:0
  }
});

Options

options.addCommonConfigVars

Type: Boolean Default value: false

Specify if you want common variables set.

options.addCommonAngularJSConfigVars

Type: Boolean Default value: false

Specify if you want common variables set for AngularJS.

options.includeJS

Type: Boolean Default value: false

Specify if you want common variables to include javascript variables.

options.includeSCSS

Type: Boolean Default value: false

Specify if you want common variables to include Sass (SCSS) variables.

Usage Examples

Default Options

In this example, the target is set to a trivial value, just to keep GruntJS happy (because there is no target with these tasks). Only 'getVar' will become available by default.

grunt.initConfig({
  var_utils:{a:0}
});

Custom Options

In this example, the target is set to a trivial value, just to keep GruntJS happy (because there is no target with these tasks). The options have all been set to true to include all featured variables on the main config object.

grunt.initConfig({
  var_utils:{
      options: {
         addCommonConfigVars: true
        ,addCommonAngularJSConfigVars: true
        ,includeJS: true
        ,includeSCSS: true
      },
      a:0
    }
});

Release History

  • 0.1.0: Initial port over from grunt.jimd.utils. 'getNestedConfigVariable' changed to 'getVar' and heavily simplified.