gulp-ng-html2js
Advanced tools
Comparing version 0.1.4 to 0.1.6
@@ -71,2 +71,3 @@ var util = require("util"); | ||
* @param [options.prefix] - The prefix which should be added to the start of the url | ||
* @param [options.rename] - A function that takes in the generated url and returns the desired manipulation. | ||
* @returns {string} | ||
@@ -90,2 +91,7 @@ */ | ||
// Rename the url | ||
if(options && options.rename){ | ||
url = options.rename(url); | ||
} | ||
return url; | ||
@@ -92,0 +98,0 @@ } |
{ | ||
"name": "gulp-ng-html2js", | ||
"version": "0.1.4", | ||
"version": "0.1.6", | ||
"description": "A Gulp plugin which generates AngularJS modules, which pre-load your HTML code into the $templateCache. This way AngularJS doesn't need to request the actual HTML files anymore.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -74,3 +74,13 @@ # gulp-ng-html2js [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url] | ||
#### options.rename | ||
Type: `Function` | ||
A function that allows the generate file url to be manipulated. For example: | ||
``` | ||
function (url) { | ||
return url.replace('.tpl.html', '.html'); | ||
} | ||
``` | ||
## License | ||
@@ -77,0 +87,0 @@ |
@@ -0,0 +0,0 @@ angular.module('fixtures/example.html', []).run(['$templateCache', function($templateCache) { |
@@ -0,0 +0,0 @@ (function(module) { |
@@ -0,0 +0,0 @@ angular.module('/partials/fixtures/example.html', []).run(['$templateCache', function($templateCache) { |
@@ -0,0 +0,0 @@ angular.module('example.html', []).run(['$templateCache', function($templateCache) { |
@@ -70,2 +70,19 @@ /*global describe, it*/ | ||
it("should allow a custom function to rename the generate file", function(done){ | ||
var expectedFile = new gutil.File({ | ||
path: "test/expected/exampleWithRename.js", | ||
cwd: "test/", | ||
base: "test/expected", | ||
contents: fs.readFileSync("test/expected/exampleWithRename.js") | ||
}); | ||
var params = { | ||
rename: function () { | ||
return "rename.html"; | ||
} | ||
}; | ||
testBufferedFile(params, expectedFile, done); | ||
}); | ||
function testBufferedFile(params, expectedFile, done){ | ||
@@ -72,0 +89,0 @@ var srcFile = new gutil.File({ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20874
16
406
97