node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


grunt-nghtml-uglify Build Status

Grunt task for nghtml-uglify

Getting Started

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, install this plugin with this command:

$ npm install --save-dev grunt-nghtml-uglify

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


Tip: the grunt-nghtml-uglify module makes it possible to keep the source code beatiful with custom angular directives, without worrying about HTML5 validation and old IE browser issues.


See the grunt docs on how to configure tasks and more advanced usage.

Example with custom config and rules

     nghtmlUglify: {
         options: {
             directives: 'configs/directives.json'
         dev: {
             files: [{
                 expand: true,
                 cwd: 'tests/',
                 src: ['*.html'],
                 dest: 'tmp/',
                 ext: '.ng.html',
                 extDot: 'first'
grunt.registerTask('default', ['nghtmlUglify']);


Please see Gruntfile as an example usage



Type: String Default: 'data-'

This config exist in case of a possible XHTML support in future release, you may safelyskip it if you are already using HTML5.


Type: String Default: ''

  • Note that you should provide one, see an example

Path to a json file which contains the angular and custom directives that are being used. In future, we may parse javascript and get the directives automatically. Yet for the time being adduming you use grunt-html-validation, you will know which directives to add to the directives.json


MIT © Ahmet Yeşil