clear
This commit is contained in:
3
node_modules/gulp-if/.editorconfig
generated
vendored
Normal file
3
node_modules/gulp-if/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[*.js]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
2
node_modules/gulp-if/.jshintignore
generated
vendored
Normal file
2
node_modules/gulp-if/.jshintignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules/**
|
||||
fixture/**
|
||||
19
node_modules/gulp-if/.jshintrc
generated
vendored
Normal file
19
node_modules/gulp-if/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"camelcase": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"regexp": true,
|
||||
"strict": true,
|
||||
"trailing": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"node": true
|
||||
}
|
||||
11
node_modules/gulp-if/.npmignore
generated
vendored
Normal file
11
node_modules/gulp-if/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
.DS_Store
|
||||
*.log
|
||||
node_modules
|
||||
build
|
||||
*.node
|
||||
components
|
||||
*.orig
|
||||
.idea
|
||||
temp.txt*
|
||||
fixture
|
||||
test
|
||||
8
node_modules/gulp-if/.travis.yml
generated
vendored
Normal file
8
node_modules/gulp-if/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "4"
|
||||
- "5"
|
||||
- "6"
|
||||
- "7"
|
||||
20
node_modules/gulp-if/LICENSE
generated
vendored
Normal file
20
node_modules/gulp-if/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2014 [Richardson & Sons, LLC](http://richardsonandsons.com/)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
231
node_modules/gulp-if/README.md
generated
vendored
Normal file
231
node_modules/gulp-if/README.md
generated
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
gulp-if 
|
||||
=======
|
||||
|
||||
A ternary gulp plugin: conditionally control the flow of vinyl objects.
|
||||
|
||||
**Note**: Badly behaved plugins can often get worse when used with gulp-if. Typically the fix is not in gulp-if.
|
||||
|
||||
**Note**: Works great with [lazypipe](https://github.com/OverZealous/lazypipe), see below
|
||||
|
||||
## Usage
|
||||
|
||||
1: Conditionally filter content
|
||||
|
||||
**Condition**
|
||||
|
||||
![][condition]
|
||||
|
||||
```javascript
|
||||
var gulpif = require('gulp-if');
|
||||
var uglify = require('gulp-uglify');
|
||||
|
||||
var condition = true; // TODO: add business logic
|
||||
|
||||
gulp.task('task', function() {
|
||||
gulp.src('./src/*.js')
|
||||
.pipe(gulpif(condition, uglify()))
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
});
|
||||
```
|
||||
Only uglify the content if the condition is true, but send all the files to the dist folder
|
||||
|
||||
|
||||
2: Ternary filter
|
||||
|
||||
**Ternary**
|
||||
|
||||
![][ternary]
|
||||
|
||||
```javascript
|
||||
var gulpif = require('gulp-if');
|
||||
var uglify = require('gulp-uglify');
|
||||
var beautify = require('gulp-beautify');
|
||||
|
||||
var condition = function (file) {
|
||||
// TODO: add business logic
|
||||
return true;
|
||||
}
|
||||
|
||||
gulp.task('task', function() {
|
||||
gulp.src('./src/*.js')
|
||||
.pipe(gulpif(condition, uglify(), beautify()))
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
});
|
||||
```
|
||||
|
||||
If condition returns true, uglify else beautify, then send everything to the dist folder
|
||||
|
||||
|
||||
3: Remove things from the stream
|
||||
|
||||
**Remove from here on**
|
||||
|
||||
![][exclude]
|
||||
|
||||
```javascript
|
||||
var gulpIgnore = require('gulp-ignore');
|
||||
var uglify = require('gulp-uglify');
|
||||
var jshint = require('gulp-jshint');
|
||||
|
||||
var condition = './gulpfile.js';
|
||||
|
||||
gulp.task('task', function() {
|
||||
gulp.src('./*.js')
|
||||
.pipe(jshint())
|
||||
.pipe(gulpIgnore.exclude(condition))
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
});
|
||||
```
|
||||
|
||||
Run JSHint on everything, remove gulpfile from the stream, then uglify and write everything else.
|
||||
|
||||
|
||||
4: Exclude things from the stream
|
||||
|
||||
**Exclude things from entering the stream**
|
||||
|
||||
![][glob]
|
||||
|
||||
```javascript
|
||||
var uglify = require('gulp-uglify');
|
||||
|
||||
gulp.task('task', function() {
|
||||
gulp.src(['./*.js', '!./node_modules/**'])
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
});
|
||||
```
|
||||
|
||||
Grab all JavaScript files that aren't in the node_modules folder, uglify them, and write them.
|
||||
This is fastest because nothing in node_modules ever leaves `gulp.src()`
|
||||
|
||||
|
||||
## works great with [lazypipe](https://github.com/OverZealous/lazypipe)
|
||||
|
||||
Lazypipe creates a function that initializes the pipe chain on use. This allows you to create a chain of events inside the gulp-if condition. This scenario will run jshint analysis and reporter only if the linting flag is true.
|
||||
|
||||
```js
|
||||
var gulpif = require('gulp-if');
|
||||
var jshint = require('gulp-jshint');
|
||||
var uglify = require('gulp-uglify');
|
||||
var lazypipe = require('lazypipe');
|
||||
|
||||
var linting = false;
|
||||
var compressing = false;
|
||||
|
||||
var jshintChannel = lazypipe()
|
||||
// adding a pipeline step
|
||||
.pipe(jshint) // notice the stream function has not been called!
|
||||
.pipe(jshint.reporter)
|
||||
// adding a step with an argument
|
||||
.pipe(jshint.reporter, 'fail');
|
||||
|
||||
gulp.task('scripts', function () {
|
||||
return gulp.src(paths.scripts.src)
|
||||
.pipe(gulpif(linting, jshintChannel()))
|
||||
.pipe(gulpif(compressing, uglify()))
|
||||
.pipe(gulp.dest(paths.scripts.dest));
|
||||
});
|
||||
```
|
||||
[source](https://github.com/spenceralger/gulp-jshint/issues/38#issuecomment-40423932)
|
||||
|
||||
## works great inside [lazypipe](https://github.com/OverZealous/lazypipe)
|
||||
|
||||
Lazypipe assumes that all function parameters are static, gulp-if arguments need to be instantiated inside each lazypipe. This difference can be easily solved by passing a function on the lazypipe step
|
||||
|
||||
```js
|
||||
var gulpif = require('gulp-if');
|
||||
var jshint = require('gulp-jshint');
|
||||
var uglify = require('gulp-uglify');
|
||||
var lazypipe = require('lazypipe');
|
||||
|
||||
var compressing = false;
|
||||
|
||||
var jsChannel = lazypipe()
|
||||
// adding a pipeline step
|
||||
.pipe(jshint) // notice the stream function has not been called!
|
||||
.pipe(jshint.reporter)
|
||||
// adding a step with an argument
|
||||
.pipe(jshint.reporter, 'fail')
|
||||
// you can't say: .pipe(gulpif, compressing, uglify)
|
||||
// because uglify needs to be instantiated separately in each lazypipe instance
|
||||
// you can say this instead:
|
||||
.pipe(function () {
|
||||
return gulpif(compressing, uglify());
|
||||
});
|
||||
// why does this work? lazypipe calls the function, passing in the no arguments to it,
|
||||
// it instantiates a new gulp-if pipe and returns it to lazypipe.
|
||||
|
||||
gulp.task('scripts', function () {
|
||||
return gulp.src(paths.scripts.src)
|
||||
.pipe(jsChannel())
|
||||
.pipe(gulp.dest(paths.scripts.dest));
|
||||
});
|
||||
```
|
||||
|
||||
[source](https://github.com/robrich/gulp-if/issues/32)
|
||||
|
||||
## gulp-if API
|
||||
|
||||
### gulpif(condition, stream [, elseStream, [, minimatchOptions]])
|
||||
|
||||
gulp-if will pipe data to `stream` whenever `condition` is truthy.
|
||||
|
||||
If `condition` is falsey and `elseStream` is passed, data will pipe to `elseStream`
|
||||
|
||||
After data is piped to `stream` or `elseStream` or neither, data is piped down-stream.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### condition
|
||||
|
||||
Type: `boolean` or [`stat`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object or `function` that takes in a vinyl file and returns a boolean or `RegularExpression` that works on the `file.path`
|
||||
|
||||
The condition parameter is any of the conditions supported by [gulp-match](https://github.com/robrich/gulp-match). The `file.path` is passed into `gulp-match`.
|
||||
|
||||
If a function is given, then the function is passed a vinyl `file`. The function should return a `boolean`.
|
||||
|
||||
##### stream
|
||||
|
||||
Stream for gulp-if to pipe data into when condition is truthy.
|
||||
|
||||
##### elseStream
|
||||
|
||||
Optional, Stream for gulp-if to pipe data into when condition is falsey.
|
||||
|
||||
##### minimatchOptions
|
||||
|
||||
Optional, if it's a glob condition, these options are passed to [minimatch](https://github.com/isaacs/minimatch).
|
||||
|
||||
|
||||
LICENSE
|
||||
-------
|
||||
|
||||
(MIT License)
|
||||
|
||||
Copyright (c) 2014 [Richardson & Sons, LLC](http://richardsonandsons.com/)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
[condition]: https://rawgithub.com/robrich/gulp-if/master/img/condition.svg
|
||||
[ternary]: https://rawgithub.com/robrich/gulp-if/master/img/ternary.svg
|
||||
[exclude]: https://rawgithub.com/robrich/gulp-if/master/img/exclude.svg
|
||||
[glob]: https://rawgithub.com/robrich/gulp-if/master/img/glob.svg
|
||||
1
node_modules/gulp-if/img/condition.svg
generated
vendored
Normal file
1
node_modules/gulp-if/img/condition.svg
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 9.2 KiB |
1
node_modules/gulp-if/img/exclude.svg
generated
vendored
Normal file
1
node_modules/gulp-if/img/exclude.svg
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 11 KiB |
1
node_modules/gulp-if/img/glob.svg
generated
vendored
Normal file
1
node_modules/gulp-if/img/glob.svg
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140" height="180"><defs></defs><g transform="translate(0,0)"><g><rect fill="#FFFFFF" stroke="none" x="0" y="0" width="140" height="180"></rect></g><g transform="matrix(1,0,0,1,50,66)"><image width="40" height="64" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAABACAYAAABoWTVaAAABKUlEQVRoQ+2Y3Q3CMAyE2wEQbEA3gVFgEsoksAIbMAIjwAYgBgCflEgFyoNzRuThIlmp2tq9fHbdn7apfLSV62skkM1QNMGNCULMnhWW/SWQJSmCIugkoLvYCezjdBEUQS8BNWovsffzRVAEnQTUqJ3A9KgL/+xUDaoGvQT0qPMS08uC/s2QNVNdo17aghaDRWEbneE42Hew7VPpwtk2M7MLn82mXwTcbH9ndv2XQFy3N0Nqx8Y2HS/VF/KyAIoXs0lKL8Q8zO5mc4YeArEpzmTGKNL0IgUiFmoRxDBAtCvO68AxiiBCrsx2Kfba5n1tAjNFzCH0olOcKWIOofcLgRFZfYkRWYPh4kQwAqlSzFIUQRFkCbD+qkERZAmw/qpBEWQJsP6qQZbgE3PaM0FYGoD6AAAAAElFTkSuQmCC" transform="translate(0,0)"></image></g><g transform="translate(0,0) matrix(1,0,0,1,20,20)"><g><g transform="translate(0,0) scale(1,0.5)"><g><g transform="scale(1,2)"><path fill="#FFFFFF" stroke="#333333" d="M 25 0 L 75 0 C 88.80711874576984 0 100 11.19288125423016 100 25 C 100 38.80711874576984 88.80711874576984 50 75 50 L 25 50 C 11.19288125423016 50 0 38.80711874576984 0 25 C 0 11.19288125423016 11.19288125423016 0 25 0 Z" stroke-miterlimit="10" stroke-width="2"></path></g></g></g></g></g><g transform="scale(1,1) matrix(1,0,0,1,22,20) translate(2,11)"><text fill="#000000" stroke="none" font-family="Arial" font-size="12px" font-style="normal" font-weight="normal" text-decoration="none" x="32.5" y="11">input</text><text fill="#000000" stroke="none" font-family="Arial" font-size="12px" font-style="normal" font-weight="normal" text-decoration="none" x="23.5" y="25">(filtered)</text></g><g transform="translate(0,0) matrix(1,0,0,1,20,110)"><g><g transform="translate(0,0) scale(1,0.5)"><g><g transform="scale(1,2)"><path fill="#FFFFFF" stroke="#333333" d="M 25 0 L 75 0 C 88.80711874576984 0 100 11.19288125423016 100 25 C 100 38.80711874576984 88.80711874576984 50 75 50 L 25 50 C 11.19288125423016 50 0 38.80711874576984 0 25 C 0 11.19288125423016 11.19288125423016 0 25 0 Z" stroke-miterlimit="10" stroke-width="2"></path></g></g></g></g></g><g transform="scale(1,1) matrix(1,0,0,1,22,110) translate(2,18)"><text fill="#000000" stroke="none" font-family="Arial" font-size="12px" font-style="normal" font-weight="normal" text-decoration="none" x="29" y="11">output</text></g></g></svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
1
node_modules/gulp-if/img/ternary.svg
generated
vendored
Normal file
1
node_modules/gulp-if/img/ternary.svg
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 11 KiB |
23
node_modules/gulp-if/index.js
generated
vendored
Normal file
23
node_modules/gulp-if/index.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var match = require('gulp-match');
|
||||
var ternaryStream = require('ternary-stream');
|
||||
var through2 = require('through2');
|
||||
|
||||
module.exports = function (condition, trueChild, falseChild, minimatchOptions) {
|
||||
if (!trueChild) {
|
||||
throw new Error('gulp-if: child action is required');
|
||||
}
|
||||
|
||||
if (typeof condition === 'boolean') {
|
||||
// no need to evaluate the condition for each file
|
||||
// other benefit is it never loads the other stream
|
||||
return condition ? trueChild : (falseChild || through2.obj());
|
||||
}
|
||||
|
||||
function classifier (file) {
|
||||
return !!match(file, condition, minimatchOptions);
|
||||
}
|
||||
|
||||
return ternaryStream(classifier, trueChild, falseChild);
|
||||
};
|
||||
107
node_modules/gulp-if/package.json
generated
vendored
Normal file
107
node_modules/gulp-if/package.json
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "gulp-if@^2.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "gulp-if",
|
||||
"name": "gulp-if",
|
||||
"rawSpec": "^2.0.1",
|
||||
"spec": ">=2.0.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"D:\\web\\layui\\res\\layui"
|
||||
]
|
||||
],
|
||||
"_from": "gulp-if@>=2.0.1 <3.0.0",
|
||||
"_id": "gulp-if@2.0.2",
|
||||
"_inCache": true,
|
||||
"_location": "/gulp-if",
|
||||
"_nodeVersion": "6.9.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/gulp-if-2.0.2.tgz_1478375593476_0.9530813253950328"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "robrich",
|
||||
"email": "robrich@robrich.org"
|
||||
},
|
||||
"_npmVersion": "3.10.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "gulp-if@^2.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "gulp-if",
|
||||
"name": "gulp-if",
|
||||
"rawSpec": "^2.0.1",
|
||||
"spec": ">=2.0.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-2.0.2.tgz",
|
||||
"_shasum": "a497b7e7573005041caa2bc8b7dda3c80444d629",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "gulp-if@^2.0.1",
|
||||
"_where": "D:\\web\\layui\\res\\layui",
|
||||
"author": {
|
||||
"name": "Rob Richardson",
|
||||
"url": "http://robrich.org/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/robrich/gulp-if/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"gulp-match": "^1.0.3",
|
||||
"ternary-stream": "^2.0.1",
|
||||
"through2": "^2.0.1"
|
||||
},
|
||||
"description": "Conditionally run a task",
|
||||
"devDependencies": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"graceful-fs": "^4.1.10",
|
||||
"jshint": "^2.9.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^3.1.2",
|
||||
"rimraf": "^2.5.4",
|
||||
"should": "^11.1.1",
|
||||
"stream-exhaust": "^1.0.1",
|
||||
"vinyl-fs": "^2.4.4"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "a497b7e7573005041caa2bc8b7dda3c80444d629",
|
||||
"tarball": "https://registry.npmjs.org/gulp-if/-/gulp-if-2.0.2.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"gitHead": "06c0b186a459f3e9f66c96b717c714cd12f56a29",
|
||||
"homepage": "https://github.com/robrich/gulp-if",
|
||||
"keywords": [
|
||||
"gulpplugin",
|
||||
"conditional",
|
||||
"if",
|
||||
"ternary"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "robrich",
|
||||
"email": "robrich@robrich.org"
|
||||
}
|
||||
],
|
||||
"name": "gulp-if",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/robrich/gulp-if.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha && jshint ."
|
||||
},
|
||||
"version": "2.0.2"
|
||||
}
|
||||
Reference in New Issue
Block a user