grunt-includes
Advanced tools
Comparing version 0.5.2 to 0.5.3
{ | ||
"name": "grunt-includes", | ||
"description": "Include other files within a file.", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"author": "vanetix <matmcfarland@gmail.com>", | ||
@@ -6,0 +6,0 @@ "main": "Gruntfile.js", |
@@ -51,7 +51,7 @@ /** | ||
if(grunt.util.kindOf(opts.includeRegexp) === 'string') { | ||
if (grunt.util.kindOf(opts.includeRegexp) === 'string') { | ||
opts.includeRegexp = new RegExp(opts.includeRegexp); | ||
} | ||
if(grunt.util.kindOf(opts.templateFileRegexp) === 'string') { | ||
if (grunt.util.kindOf(opts.templateFileRegexp) === 'string') { | ||
opts.templateFileRegexp = new RegExp(opts.templateFileRegexp); | ||
@@ -67,7 +67,7 @@ } | ||
src = f.src.filter(function(p) { | ||
if(cwd) { | ||
if (cwd) { | ||
p = path.join(f.cwd, p); | ||
} | ||
if(grunt.file.isFile(p)) { | ||
if (grunt.file.isFile(p)) { | ||
return true; | ||
@@ -80,3 +80,3 @@ } else { | ||
if(src.length > 1 && isFilename(f.dest)) { | ||
if (src.length > 1 && isFilename(f.dest)) { | ||
grunt.fail.fatal('Source file cannot be more than one when dest is a file.'); | ||
@@ -89,3 +89,3 @@ } | ||
if(cwd) { | ||
if (cwd) { | ||
p = path.join(cwd, p); | ||
@@ -96,3 +96,3 @@ } | ||
if(!opts.silent) { | ||
if (!opts.silent) { | ||
grunt.log.oklns('Saved ' + outFile); | ||
@@ -161,3 +161,3 @@ } | ||
if(!grunt.file.isFile(p)) { | ||
if (!grunt.file.isFile(p)) { | ||
grunt.fail.warn('Included file "' + p + '" not found.'); | ||
@@ -173,7 +173,10 @@ return 'Error including "' + p + '".'; | ||
// If `opts.duplicates` is false and file has been included, error | ||
if(!opts.duplicates && ~included.indexOf(p)) { | ||
if (!opts.duplicates && ~included.indexOf(p)) { | ||
error = 'Duplicate include: ' + p + ' skipping.'; | ||
grunt.log.error(error); | ||
if(opts.debug) { | ||
if (!opts.silent) { | ||
grunt.log.error(error); | ||
} | ||
if (opts.debug) { | ||
return comment.replace(/%s/g, error); | ||
@@ -196,3 +199,3 @@ } else { | ||
// If the line has an include statement, recurse | ||
if(match) { | ||
if (match) { | ||
indent = match[1]; | ||
@@ -207,3 +210,3 @@ fileLocation = match[2]; | ||
// If a full filepath + extension is given, use it instead of building | ||
if(isFilename(fileLocation)) { | ||
if (isFilename(fileLocation)) { | ||
fileLocation = fileLocation; | ||
@@ -215,3 +218,3 @@ } else { | ||
// Try to locate the file through multiple includePath if array | ||
if(grunt.util.kindOf(opts.includePath) === 'array') { | ||
if (grunt.util.kindOf(opts.includePath) === 'array') { | ||
opts.includePath.some(function(p) { | ||
@@ -222,3 +225,3 @@ next = path.join(p, fileLocation); | ||
if(!next) { | ||
if (!next) { | ||
next = path.join(path.dirname(p), fileLocation); | ||
@@ -233,3 +236,3 @@ } | ||
// Wrap file around in template if `opts.template` has '{{file}}' in it. | ||
if(opts.template !== '' && opts.template.match(opts.templateFileRegexp)) { | ||
if (opts.template !== '' && opts.template.match(opts.templateFileRegexp)) { | ||
currentTemplate = opts.template.split(newline).map(function(line) { | ||
@@ -255,3 +258,3 @@ line = line.replace(templateFilenameRegexp, fileLocation); | ||
// Include debug comments if `opts.debug` | ||
if(opts.debug) { | ||
if (opts.debug) { | ||
line = comment.replace(/%s/g, 'Begin: ' + next) + | ||
@@ -258,0 +261,0 @@ newline + line + comment.replace(/%s/g, 'End: ' + next); |
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
17765
294