Skip to content

Instantly share code, notes, and snippets.

@vilmosioo
Created September 16, 2013 15:02
Show Gist options
  • Save vilmosioo/6581817 to your computer and use it in GitHub Desktop.
Save vilmosioo/6581817 to your computer and use it in GitHub Desktop.
Example usage of ng-constant. Replace <...> with appropriate values.
grunt.initConfig({
ngconstant: {
<task>: [
{
dest: '<destination file>',
name: '<module name>',
constants: {
'<constant name>': '<constant value>',
'<constant name>': { ... }
'<constant name>': grunt.file.readJSON('<JSON file>')
...
}
}
]
},
})
@crystalschang
Copy link

I'd suggest changing the format to pull the options object out of the array:

grunt.initConfig({
  ngconstant: {
    <task>: {
      dest: '<destination file>',
      name: '<module name>',
      constants: {
        '<constant name>': '<constant value>',
        '<constant name>': { ... }
        '<constant name>': grunt.file.readJSON('<JSON file>')
        ...
      }
    }
  },
})

If you leave it in the array, grunt will complain and fail when you run grunt tests in verbose mode (grunt test --verbose).

@vilmosioo
Copy link
Author

Oh thanks for sharing! But I do not see any warnings in my grunt test...
Why would grunt complain because it's an array?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment