gulp-angular-htmlify
Advanced tools
Comparing version 0.1.0 to 0.2.0
34
index.js
@@ -9,30 +9,6 @@ 'use strict'; | ||
var verbose = params.verbose || false; | ||
var customPrefixes = params.customPrefixes || []; | ||
var htmlify = require('angular-html5')({ | ||
customPrefixes: params.customPrefixes | ||
}); | ||
//find ng-something by default | ||
var prefix = 'ng-'; | ||
//optionally add custom prefixes | ||
if (customPrefixes && customPrefixes.length) { | ||
var additions = customPrefixes.join('|'); | ||
prefix += '|'; | ||
prefix += additions; | ||
} | ||
//wrap around to insert into replace str later | ||
prefix = '(' + prefix + '){1}'; | ||
//handle the following: | ||
//1. ' ng-' | ||
//2. '<ng-' | ||
//3. '</ng-' | ||
var allowedPreChars = '(\\s|<|<\/){1}'; | ||
//build find/replace regex | ||
//$1 -> allowable pre-chars | ||
//$2 -> prefix match | ||
//$3 -> actual directive (partially) | ||
var replaceRegex = new RegExp(allowedPreChars + prefix + '(\\w+)', 'ig'); | ||
//replace with data-ng-something | ||
var replaceStr = '$1data-$2$3'; | ||
return through.obj(function (file, enc, cb) { | ||
@@ -53,4 +29,4 @@ //pass through | ||
//if ng-directives exist | ||
if (replaceRegex.test(data)) { | ||
data = data.replace(replaceRegex, replaceStr); | ||
if (htmlify.test(data)) { | ||
data = htmlify.replace(data); | ||
//put contents back | ||
@@ -57,0 +33,0 @@ file.contents = new Buffer(data); |
The MIT License (MIT) | ||
Copyright (c) [2014] [Gilad Peleg] | ||
Copyright (©) 2014 Gilad Peleg | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of |
{ | ||
"name": "gulp-angular-htmlify", | ||
"description": "Change your ng-attributes to data-ng-attributes for html5 validation", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"engines": { | ||
@@ -39,8 +39,10 @@ "node": ">=0.10.0" | ||
"devDependencies": { | ||
"mocha": "^1.20.0" | ||
"gulp-util": "^2.2.16", | ||
"mocha": "^1.20.1" | ||
}, | ||
"dependencies": { | ||
"angular-html5": "^0.1.1", | ||
"gulp-util": "^2.2.14", | ||
"through2": "^0.4.2" | ||
"through2": "^0.5.1" | ||
} | ||
} |
@@ -53,2 +53,4 @@ # [gulp](https://github.com/wearefractal/gulp)-angular-htmlify | ||
*Issues with the output should be reported on the ng-annotate [issue tracker](https://github.com/pgilad/angular-html5/issues).* | ||
## Install | ||
@@ -55,0 +57,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118
6577
3
2
39
+ Addedangular-html5@^0.1.1
+ Addedangular-html5@0.1.1(transitive)
- Removedobject-keys@0.4.0(transitive)
- Removedthrough2@0.4.2(transitive)
- Removedxtend@2.1.2(transitive)
Updatedthrough2@^0.5.1