grunt-strip-code
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -163,2 +163,26 @@ /* | ||
src: 'test/tmp/legacy_start_end.js' | ||
}, | ||
custom_eol_lf: { | ||
options: { | ||
eol: 'lf', | ||
blocks: [ | ||
{ | ||
start_block: '/* exclude:start */', | ||
end_block: '/* exclude:stop */' | ||
} | ||
] | ||
}, | ||
src: 'test/tmp/custom_eol1.js' | ||
}, | ||
custom_eol_crlf: { | ||
options: { | ||
eol: 'crlf', | ||
blocks: [ | ||
{ | ||
start_block: '/* exclude:start */', | ||
end_block: '/* exclude:stop */' | ||
} | ||
] | ||
}, | ||
src: 'test/tmp/custom_eol2.js' | ||
} | ||
@@ -165,0 +189,0 @@ }, |
{ | ||
"name": "grunt-strip-code", | ||
"description": "Remove dev and test only code in production builds", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"homepage": "https://github.com/nuzzio/grunt-strip-code", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -25,3 +25,3 @@ # grunt-strip-code | ||
## Getting Started | ||
This plugin requires Grunt `>=0.4.0 <=1.0.1` | ||
This plugin requires Grunt `>=0.4.0` | ||
@@ -105,2 +105,9 @@ If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: | ||
#### options.eol | ||
Type: `String` | ||
Choices: `'lf'`, `'cr'`, `'crlf'` | ||
Default value: `''` | ||
Unless one of the choices is explicitly specified, end-of-line defaults to the operating system specific character(s). | ||
### Usage Examples | ||
@@ -302,2 +309,6 @@ | ||
#### 1.0.5 | ||
Custom line endings contributed. | ||
#### 1.0.4 | ||
@@ -304,0 +315,0 @@ |
@@ -63,5 +63,26 @@ /* | ||
end_comment: false, | ||
pattern: false | ||
pattern: false, | ||
eol: '' | ||
}); | ||
// | ||
// Allow custom end-of-line, if specified. | ||
// | ||
var endOfLine; | ||
switch(options.eol) { | ||
case 'lf': | ||
endOfLine = '\n'; | ||
break; | ||
case 'crlf': | ||
endOfLine = '\r\n'; | ||
break; | ||
default: | ||
endOfLine = grunt.util.linefeed; | ||
break; | ||
} | ||
/** | ||
@@ -178,3 +199,3 @@ * Takes in dynamic parameters and expects first param to be a key for a string, | ||
'[\\t ]*', | ||
escapeStringRegexp(grunt.util.linefeed) + '?' | ||
escapeStringRegexp(endOfLine) + '?' | ||
]; | ||
@@ -375,3 +396,3 @@ | ||
*/ | ||
contents.split(grunt.util.linefeed).forEach(checkLine); | ||
contents.split(endOfLine).forEach(checkLine); | ||
@@ -378,0 +399,0 @@ /** |
@@ -13,2 +13,3 @@ /** | ||
var helper = require('./helper.js').helper; | ||
var os = require('os'); | ||
@@ -208,3 +209,59 @@ /* | ||
test.done(); | ||
}, | ||
custom_eol_lf: function (test) { | ||
test.expect(1); | ||
var file = 'custom_eol1.js'; | ||
var actual = helper.tmpReader(file); | ||
var expected; | ||
if (os.EOL === '\n') { | ||
expected = helper.expectedReader('custom_eol_stripped.js'); | ||
test.equal( | ||
actual, | ||
expected, | ||
'should strip code when default end-of-line is "lf"' | ||
); | ||
} else { | ||
expected = helper.expectedReader('custom_eol_as_is.js'); | ||
test.equal( | ||
actual, | ||
expected, | ||
'should not strip code when default end-of-line is not "lf"' | ||
); | ||
} | ||
test.done(); | ||
}, | ||
custom_eol_crlf: function (test) { | ||
test.expect(1); | ||
var file = 'custom_eol2.js'; | ||
var actual = helper.tmpReader(file); | ||
var expected; | ||
if (os.EOL === '\r\n') { | ||
expected = helper.expectedReader('custom_eol_stripped.js'); | ||
test.equal( | ||
actual, | ||
expected, | ||
'should strip code when default end-of-line is "crlf"' | ||
); | ||
} else { | ||
expected = helper.expectedReader('custom_eol_as_is.js'); | ||
test.equal( | ||
actual, | ||
expected, | ||
'should not strip code when default end-of-line is not "crlf"' | ||
); | ||
} | ||
test.done(); | ||
} | ||
}; |
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
44033
41
992
339