Easilly add the needed w3c Sri informations to your html and jade files.
Install this library via NPM:
npm install gulp-srizer --save
var srizer = require('gulp-srizer');
gulp.task('sri', function() {
return gulp.src('path/to/your/jade/or/html/files')
.pipe(srizer())
.pipe(gulp.dest('/where/should/we/write/them'));
});
- fileExt: resource's extension we want to add SRIs for (default: css, js)
example:
srizer({fileExt: 'css'});
// or
srizer({fileExt: ['css', 'js']});
- path: where should we look for resource files. By default this path is inferred by the location of your html/jade files
example:
srizer({path: '/path/to/your/resources'});
- algo: which hashing algorithm should be used (default: sha256)
example:
srizer({algo: 'sha512'});
- prefix: where should we prepend of not the algorithm to the has or not (default: true)
example:
srizer({prefix: false});
If you're using gulp-cdnizer or gulp-rev-all in your project, we suggest your sri
task to be the last one.
##Tests
Have mocha installed and: npm test