Grunt task for the javascript HE html entities handler. For now, it just encodes a string. It's based on mathiasbynens's excelent HE
This plugin requires Grunt ~0.4.5
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-he --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-he');
In your project's Gruntfile, add a section named he
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
he: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
The options for this task can be found at HE's encode text options
Replace all the non-entity characters in all HTML files under directory html/to_validate. The final files will be outputted to html/validated.
grunt.initConfig({
he: {
options: {
'useNamedReferences': true,
'allowUnsafeSymbols': true
},
compileMultiple: {
files: [{
expand: true,
cwd: 'html/to_validate',
src: '**/*.html',
dest: 'html/validated'
}]
}
},
});
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)