browserify-ng-html2js
Advanced tools
Comparing version 1.0.1 to 1.1.0
# Changelog | ||
# 1.0.1 | ||
## 1.1.0 | ||
* Support prefixes for template names | ||
## 1.0.1 | ||
* Template path is printed correctly on windows when using baseDir option | ||
@@ -6,0 +10,0 @@ |
@@ -24,2 +24,3 @@ var fs = require('fs'), | ||
opts.baseDir = opts.baseDir || null; | ||
opts.prefix = opts.prefix || ''; | ||
@@ -41,2 +42,3 @@ var fileMatching = new RegExp("^.*\\" + path.sep + "(.*)$"); | ||
fileName = opts.baseDir ? file.replace(path.join(appDir, opts.baseDir), '').replace(/\\/g, '/') : file.match(fileMatching)[1]; | ||
fileName = opts.prefix + fileName; | ||
content = fs.readFileSync(file, 'utf-8'); | ||
@@ -43,0 +45,0 @@ src = ngHtml2Js(fileName, content, opts.module, 'ngModule') + '\nmodule.exports = ngModule;'; |
{ | ||
"name": "browserify-ng-html2js", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Browserify transform to compile angular templates into angular modules", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -56,2 +56,3 @@ # browserify-ng-html2js | ||
baseDir: "src/js" // optionally specify base directory for filename | ||
prefix: '' // optionally specify a prefix to be added to the filename | ||
})) | ||
@@ -58,0 +59,0 @@ .bundle() |
@@ -81,2 +81,18 @@ var browserify = require('browserify'), | ||
}); | ||
it('should add prefix to filename if one is provided', function(done) { | ||
var output = fs.readFileSync(__dirname + '/fixtures/output-prefix.js', 'utf-8'); | ||
browserify(__dirname + '/fixtures/app.js') | ||
.transform(ngHtml2Js({ | ||
prefix: '/app.templates/' | ||
})) | ||
.bundle(function(err, bundle) { | ||
if (err) { | ||
done(err) | ||
} else { | ||
expect(output).to.equal(bundle.toString()); | ||
done(); | ||
}; | ||
}); | ||
}); | ||
}) |
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
13699
15
190
81
10