grunt-include-source
Advanced tools
Comparing version
@@ -7,2 +7,7 @@ # Changelog | ||
### 2015-09-19 ver. 0.7.0 | ||
* Use global config to parse template variables in baseUrl strings (see https://github.com/jwvdiermen/grunt-include-source/pull/41) | ||
* Fix when the offset is negative, endMarker position calculations fail (see https://github.com/jwvdiermen/grunt-include-source/pull/43) | ||
### 2015-07-10 ver. 0.6.1 | ||
@@ -9,0 +14,0 @@ |
@@ -35,2 +35,3 @@ /* | ||
testFilesPath: 'test/files', | ||
testFilesUrl: 'test/files/', | ||
multipleBasePath: [ | ||
@@ -72,2 +73,10 @@ '<%= vars.testFilesPath %>', | ||
}, | ||
baseUrlHtmlTest: { | ||
options: { | ||
baseUrl: '<%= vars.testFilesUrl %>', | ||
}, | ||
files: { | ||
'tmp/baseUrl.html': '<%= vars.testFilesPath %>/baseUrl.html' | ||
} | ||
}, | ||
htmlTest: { | ||
@@ -74,0 +83,0 @@ files: { |
{ | ||
"name": "grunt-include-source", | ||
"description": "Include your sources into your HTML files automatically.", | ||
"version": "0.6.1", | ||
"version": "0.7.0", | ||
"homepage": "https://github.com/jwvdiermen/grunt-include-source", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -285,2 +285,3 @@ /* | ||
var files = []; | ||
var baseUrl; | ||
if (include.options.target && options.target !== include.options.target) { | ||
@@ -292,2 +293,8 @@ grunt.log.debug('Include target is "' + include.options.target + '" and task target is "' + options.target + '", skipping include.'); | ||
orderFiles(files, include.options); | ||
if(include.options.baseUrl) { | ||
baseUrl = grunt.config.process(include.options.baseUrl); | ||
} else { | ||
baseUrl = options.baseUrl; | ||
} | ||
@@ -334,4 +341,4 @@ var sep = os.EOL, | ||
includeFragments.push(typeTemplates[includeType] | ||
.replace(/\{filePath\}/g, url.resolve(include.options.baseUrl || options.baseUrl, file)) | ||
.replace(/\{filePathDecoded\}/g, decodeURI(url.resolve(include.options.baseUrl || options.baseUrl, file))) | ||
.replace(/\{filePath\}/g, url.resolve(baseUrl, file)) | ||
.replace(/\{filePathDecoded\}/g, decodeURI(url.resolve(baseUrl, file))) | ||
); | ||
@@ -347,4 +354,4 @@ }); | ||
var nextInclude = includes[includeIndex + 1]; | ||
var nextPartIndex = nextInclude ? nextInclude.start : contents.length; | ||
var between = contents.substring(include.start + currentOffset, nextPartIndex + currentOffset); | ||
var nextPartIndex = nextInclude ? (nextInclude.start + currentOffset): contents.length; | ||
var between = contents.substring(include.start + currentOffset, nextPartIndex); | ||
@@ -351,0 +358,0 @@ endMarker = findEndMarker(between, include.start); |
85571
24.96%73
5.8%543
4.22%8
14.29%