
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
gulp-angular-htmlify
Advanced tools
Change your ng-attributes to data-ng-attributes for HTML5 validation
Ever tried to run an Angular HTML page into w3c validator? Yeah it's a mess.
The solution everyone recommends is to add data to all your ng directives.
Now with gulp this can be easily made part of your build flow, similar to how
ng-min is to creating minifiable Angular syntax.
Turn this:
<html ng-app="myApp">
...
<body ng-controller="MainCtrl">
</body>
</html>
Into this:
<html data-ng-app="myApp">
...
<body data-ng-controller="MainCtrl">
</body>
</html>

gulp-angular-htmlify looks for ng- directives by default and can handle the following cases:
<!-- attribute -->
<ANY ng-directive>
<!-- regular element -->
<ng-directive></ng-directive>
<!-- self closing element -->
<ng-directive />
<!-- custom directive prefix -->
<ui-router></ui-router>
<!-- your name prefix -->
<gilad-cool-loader></gilad-cool-loader>
You can add additional prefixes using the option customPrefixes.
This plugin plays nice with type="text/ng-template" and won't break it.
Issues with the output should be reported on the angular-html5 issue tracker.
Install with npm
npm install --save-dev gulp-angular-htmlify
var gulp = require('gulp');
var htmlify = require('gulp-angular-htmlify');
//simple usage
gulp.task('htmlify', function() {
gulp.src('public/**/*.html')
.pipe(htmlify())
.pipe(gulp.dest('build/'));
});
//using jade as a pre-processer
gulp.task('htmlify', function() {
gulp.src('partials/**/*.jade')
.pipe(jade())
.pipe(htmlify())
.pipe(gulp.dest('build/'));
});
//Also transforming ui-attributes to data-ui-attributes
gulp.task('htmlify', function() {
gulp.src('public/**/*.html')
.pipe(htmlify({
customPrefixes: ['ui-']
}))
.pipe(gulp.dest('build/'));
});
params is an object that contains the following settings:
Type: Array
Default: []
An array to optionally add custom prefixes to the list of converted directives.
For example: ['ui-', 'gijo-']
By default only ng- prefixes are are handled. Any items you add here will be handled as well.
Note: for this to work - you will need to make sure your directives can load with a data- prefix.
Type: Boolean
Default: false
Whether to log files that had ng-directives detected and replaced. (Useful for debugging).
Example usage:
//...
.pipe(htmlify({
verbose:true,
customPrefixes: ['ui-']
}))
// --> [gulp] Found and replaced ng-directives in index.html
//...
MIT ©2014 Gilad Peleg
FAQs
Change your ng-attributes to data-ng-attributes for HTML5 validation
The npm package gulp-angular-htmlify receives a total of 845 weekly downloads. As such, gulp-angular-htmlify popularity was classified as not popular.
We found that gulp-angular-htmlify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.