grunt-includes
Advanced tools
Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "grunt-includes", | ||
"description": "Include other files within a file.", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": "vanetix <matmcfarland@gmail.com>", | ||
@@ -6,0 +6,0 @@ "main": "Gruntfile.js", |
@@ -108,2 +108,3 @@ # grunt-includes [![Build Status](https://travis-ci.org/vanetix/grunt-includes.png?branch=master)](https://travis-ci.org/vanetix/grunt-includes) | ||
## Release History | ||
- 0.2.3 - Fix bug when building source files from a different platform. Thanks [wGEric](https://github.com/wGEric)! | ||
- 0.2.0 - Support for expandable paths and debugging. Thanks [@ktmud](https://github.com/ktmud)! | ||
@@ -110,0 +111,0 @@ - 0.1.0 - Updated for grunt 0.4 |
@@ -24,2 +24,8 @@ /* | ||
/** | ||
* Regex for matching new lines | ||
*/ | ||
var newlineRegexp = /\r?\n/g; | ||
/** | ||
* Core `grunt-includes` task | ||
@@ -97,2 +103,15 @@ * Iterates over all source files and calls `recurse(path)` on each | ||
/** | ||
* Returns the new line style for file `p` | ||
* | ||
* @param {String} p | ||
* @return {String} | ||
*/ | ||
function newlineStyle(p) { | ||
var matches = grunt.file.read(p).match(newlineRegexp); | ||
return matches[0] || grunt.util.linefeed; | ||
} | ||
/** | ||
* Helper for `includes` builds all includes for `p` | ||
@@ -105,5 +124,6 @@ * | ||
function recurse(p, opts, included) { | ||
var src, next, match, error, comment, compiled; | ||
var src, next, match, error, comment, newline, compiled; | ||
comment = commentStyle(p); | ||
newline = newlineStyle(p); | ||
included = included || []; | ||
@@ -142,3 +162,3 @@ | ||
src = grunt.file.read(p).split(grunt.util.linefeed); | ||
src = grunt.file.read(p).split(newline); | ||
@@ -166,3 +186,3 @@ /** | ||
line = comment.replace(/%s/g, 'Begin: ' + next) + | ||
'\n' + line + '\n' + comment.replace(/%s/g, 'End: ' + next); | ||
newline + line + newline + comment.replace(/%s/g, 'End: ' + next); | ||
} | ||
@@ -174,5 +194,5 @@ } | ||
return compiled.join(grunt.util.linefeed); | ||
return compiled.join(newline); | ||
} | ||
}; |
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
9247
146
119