grunt-includes
Advanced tools
Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "grunt-includes", | ||
"description": "Include other files within a file.", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "vanetix <matmcfarland@gmail.com>", | ||
@@ -6,0 +6,0 @@ "main": "Gruntfile.js", |
@@ -37,5 +37,14 @@ # grunt-includes [![Build Status](https://travis-ci.org/vanetix/grunt-includes.png?branch=master)](https://travis-ci.org/vanetix/grunt-includes) | ||
Type: `RegExp` | ||
Default: `/^(\s*)include\s+"(\S+)"\s*$/` | ||
Matches: `include "some/file.html"` | ||
Sets the regular expression used to find *include* statements. The file path should always be the `$1`. | ||
Sets the regular expression used to find *include* statements. | ||
A regex group is used to identify the important parts of the include statement. When constructing your own regex, it can contain up to two groups (denoted by parentheses `()` in the regular expression): | ||
1. The indentation whitespace to be appended to the front of the included file's contents | ||
2. The file location | ||
**All regular expressions used must contain at least one group.** If only one group is used, it will be assumed to contain the file path. | ||
## Usage | ||
@@ -42,0 +51,0 @@ |
@@ -138,3 +138,3 @@ /* | ||
function recurse(p, opts, included, indents) { | ||
var src, next, match, error, comment, newline, compiled; | ||
var src, next, match, error, comment, newline, compiled, indent, fileLocation; | ||
@@ -191,5 +191,13 @@ indents = indents || ''; | ||
if(match) { | ||
next = path.join(path.dirname(p), match[2]); | ||
line = recurse(next, opts, included, indents + match[1]); | ||
fileLocation = match[2]; | ||
indent = match[1]; | ||
if (!fileLocation) { | ||
fileLocation = indent; | ||
indent = ''; | ||
} | ||
next = path.join(path.dirname(p), fileLocation); | ||
line = recurse(next, opts, included, indents + indent); | ||
/** | ||
@@ -196,0 +204,0 @@ * Include debug comments if `opts.debug` |
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
10698
167
139