grunt-includes
Advanced tools
Comparing version 0.3.3 to 0.3.4
{ | ||
"name": "grunt-includes", | ||
"description": "Include other files within a file.", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"author": "vanetix <matmcfarland@gmail.com>", | ||
@@ -6,0 +6,0 @@ "main": "Gruntfile.js", |
@@ -15,2 +15,4 @@ # grunt-includes [![Build Status](https://travis-ci.org/vanetix/grunt-includes.png?branch=master)](https://travis-ci.org/vanetix/grunt-includes) | ||
An example site can be found at [grunt-includes-example](https://github.com/vanetix/grunt-includes-example). | ||
## Options | ||
@@ -42,2 +44,8 @@ | ||
#### includePath | ||
Type: `String` | ||
Default: `` | ||
Indicates the path to use when looking for included files. Instead of using relative path in the include statements, use includePath as base directory. | ||
#### includeRegexp | ||
@@ -136,2 +144,3 @@ Type: `RegExp` | ||
## Release History | ||
- 0.3.4 - Add explicit include path option. | ||
- 0.3.2 - Add silent flag to silence save messages. | ||
@@ -138,0 +147,0 @@ - 0.3.0 - Add indention preservation and banner support |
@@ -46,3 +46,4 @@ /* | ||
duplicates: true, | ||
includeRegexp: defaultRegexp | ||
includeRegexp: defaultRegexp, | ||
includePath: '' | ||
}); | ||
@@ -143,4 +144,10 @@ | ||
function recurse(p, opts, included, indents) { | ||
var src, next, match, error, comment, newline, compiled, indent, fileLocation; | ||
var src, next, match, error, comment, | ||
newline, compiled, indent, fileLocation; | ||
if(!grunt.file.isFile(p)) { | ||
grunt.log.warn('Included file "' + p + '" not found.'); | ||
return 'Error including "' + p + '".'; | ||
} | ||
indents = indents || ''; | ||
@@ -151,7 +158,2 @@ comment = commentStyle(p); | ||
if(!grunt.file.isFile(p)) { | ||
grunt.log.warn('Included file "' + p + '" not found.'); | ||
return 'Error including "' + p + '".'; | ||
} | ||
/** | ||
@@ -205,3 +207,3 @@ * If `opts.duplicates` is false and file has been included, | ||
next = path.join(path.dirname(p), fileLocation); | ||
next = path.join((opts.includePath || path.dirname(p)), fileLocation); | ||
line = recurse(next, opts, included, indents + indent); | ||
@@ -208,0 +210,0 @@ |
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
11320
172
156