-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
Fixes `cwd` being part of the $templateCache string when `expand:true`
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ var Url = require('url'); | |
* @param {String} cwd Determines if paths are relative or not | ||
* @return {Object} | ||
*/ | ||
var Compiler = function(grunt, options, cwd) { | ||
var Compiler = function(grunt, options, cwd, expanded) { | ||
|
||
/** | ||
* Wrap individual cache registration script in bootstrap function | ||
|
@@ -44,6 +44,10 @@ var Compiler = function(grunt, options, cwd) { | |
path = path.replace(/\/?$/, '/'); | ||
} | ||
|
||
if(cwd && expanded){ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
underscorebrody
Author
Collaborator
|
||
url = url.replace(cwd, '').replace(/^\//,''); | ||
} | ||
|
||
// Append formatted URL | ||
path += Url.format( Url.parse( url.replace(/\\/g, '/') ) ); | ||
|
||
|
@@ -166,7 +170,7 @@ var Compiler = function(grunt, options, cwd) { | |
* @return {String} Template path | ||
*/ | ||
this.path = function(file) { | ||
if (cwd) { | ||
if (cwd && !expanded) { | ||
return cwd + '/' + file; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
angular.module('relative_url_expand').run(['$templateCache', function($templateCache) { | ||
'use strict'; | ||
|
||
$templateCache.put('three/three.html', | ||
"<h2>Three</h2>\n" + | ||
"\n" + | ||
"<!-- Comment for three -->\n" + | ||
"\n" + | ||
"<textarea readonly=\"readonly\">We are three.</textarea>\n" | ||
); | ||
|
||
}]); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
angular.module('relative_url_expand').run(['$templateCache', function($templateCache) { | ||
'use strict'; | ||
|
||
$templateCache.put('three/three_two.html', | ||
"<h2>Three Two</h2>\n" + | ||
"\n" + | ||
"<!-- Comment for three two -->\n" + | ||
"\n" + | ||
"<textarea readonly=\"readonly\">We are three two.</textarea>\n" | ||
); | ||
|
||
}]); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h2>Three</h2> | ||
|
||
<!-- Comment for three --> | ||
|
||
<textarea readonly="readonly">We are three.</textarea> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h2>Three Two</h2> | ||
|
||
<!-- Comment for three two --> | ||
|
||
<textarea readonly="readonly">We are three two.</textarea> |
Its a bug, causes all cwd instances to be replaced in path.