--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
7
node_modules/gulp-concat-css/.npmignore
generated
vendored
Executable file
7
node_modules/gulp-concat-css/.npmignore
generated
vendored
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
node_modules
|
||||
.c9revisions
|
||||
.settings
|
||||
.idea
|
||||
.DS_Store
|
||||
npm-debug.log
|
||||
bundle.css
|
||||
5
node_modules/gulp-concat-css/.travis.yml
generated
vendored
Executable file
5
node_modules/gulp-concat-css/.travis.yml
generated
vendored
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.12"
|
||||
- "0.10"
|
||||
- "iojs"
|
||||
21
node_modules/gulp-concat-css/LICENSE
generated
vendored
Executable file
21
node_modules/gulp-concat-css/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Mario Casciaro
|
||||
|
||||
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.
|
||||
43
node_modules/gulp-concat-css/README.md
generated
vendored
Normal file
43
node_modules/gulp-concat-css/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# [gulp](https://github.com/wearefractal/gulp)-concat-css
|
||||
[](https://travis-ci.org/mariocasciaro/gulp-concat-css)
|
||||
[](https://www.npmjs.org/package/gulp-concat-css)
|
||||
[](https://david-dm.org/mariocasciaro/gulp-concat-css)
|
||||
[](https://www.npmjs.org/package/gulp-concat-css)
|
||||
|
||||
> Concatenates css files, bubbling up @import statements (as per the [standard](https://developer.mozilla.org/en-US/docs/Web/CSS/@import)), and optionally rebasing urls and inlining local @import statements.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://npmjs.org/package/gulp-concat-css).
|
||||
|
||||
```
|
||||
npm install --save-dev gulp-concat-css
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
var gulp = require('gulp');
|
||||
var concatCss = require('gulp-concat-css');
|
||||
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('assets/**/*.css')
|
||||
.pipe(concatCss("styles/bundle.css"))
|
||||
.pipe(gulp.dest('out/'));
|
||||
});
|
||||
```
|
||||
|
||||
**TIP: for a proper import inlining and url rebase, make sure you set the proper `base` for the input files.**
|
||||
|
||||
## API
|
||||
|
||||
`concatCss(targetFile, options)`
|
||||
* `targetFile`: The relative path of the generated file containing the concatenated css
|
||||
* `options`: (since 2.1.0)
|
||||
* `inlineImports`: (default `true`) Inline any local import statement found
|
||||
* `rebaseUrls`: (default `true`) Adjust any relative URL to the location of the target file.
|
||||
* `includePaths`: (default `[]`) Include additional paths when inlining imports
|
||||
|
||||
## License
|
||||
|
||||
[MIT](http://en.wikipedia.org/wiki/MIT_License) @ Mario Casciaro
|
||||
134
node_modules/gulp-concat-css/index.js
generated
vendored
Normal file
134
node_modules/gulp-concat-css/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
'use strict';
|
||||
var gutil = require('gulp-util');
|
||||
var path = require('path');
|
||||
var rework = require('rework');
|
||||
var reworkImport = require('rework-import');
|
||||
var through = require('through2');
|
||||
var parseImport = require('parse-import');
|
||||
var reworkUrl = require('rework-plugin-url');
|
||||
var defaults = require('lodash.defaults');
|
||||
|
||||
module.exports = function(destFile, options) {
|
||||
var buffer = [];
|
||||
var firstFile, commonBase;
|
||||
var destDir = path.dirname(destFile);
|
||||
var urlImportRules = [];
|
||||
options = defaults({}, options, {
|
||||
inlineImports: true,
|
||||
rebaseUrls: true,
|
||||
includePaths: []
|
||||
});
|
||||
|
||||
return through.obj(function(file, enc, cb) {
|
||||
var processedCss;
|
||||
|
||||
if (file.isStream()) {
|
||||
this.emit('error', new gutil.PluginError('gulp-concat-css', 'Streaming not supported'));
|
||||
return cb();
|
||||
}
|
||||
|
||||
if(!firstFile) {
|
||||
firstFile = file;
|
||||
commonBase = file.base;
|
||||
}
|
||||
|
||||
function urlPlugin(file) {
|
||||
return reworkUrl(function(url) {
|
||||
if(isUrl(url) || isDataURI(url) || path.extname(url) === '.css' || path.resolve(url) === url) {
|
||||
return url;
|
||||
}
|
||||
|
||||
var resourceAbsUrl = path.relative(commonBase, path.resolve(path.dirname(file), url));
|
||||
resourceAbsUrl = path.relative(destDir, resourceAbsUrl);
|
||||
//not all systems use forward slash as path separator
|
||||
//this is required by urls.
|
||||
if(path.sep === '\\'){
|
||||
//replace with forward slash
|
||||
resourceAbsUrl = resourceAbsUrl.replace(/\\/g, '/');
|
||||
}
|
||||
return resourceAbsUrl;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function collectImportUrls(styles) {
|
||||
var outRules = [];
|
||||
styles.rules.forEach(function(rule) {
|
||||
if(rule.type !== 'import') {
|
||||
return outRules.push(rule);
|
||||
}
|
||||
|
||||
var importData = parseImport('@import ' + rule.import + ';');
|
||||
var importPath = importData && importData[0].path;
|
||||
if(isUrl(importPath) || !options.inlineImports) {
|
||||
return urlImportRules.push(rule);
|
||||
}
|
||||
return outRules.push(rule);
|
||||
});
|
||||
styles.rules = outRules;
|
||||
}
|
||||
|
||||
|
||||
function processNestedImport(contents) {
|
||||
var rew = rework(contents,{source:this.source});//find the css file has syntax errors
|
||||
if(options.rebaseUrls) {
|
||||
rew = rew.use(urlPlugin(this.source));
|
||||
}
|
||||
rew = rew.use(collectImportUrls);
|
||||
return rew.toString();
|
||||
}
|
||||
|
||||
try {
|
||||
processedCss = rework(String(file.contents||""),{source:file.path});//find the css file has syntax errors
|
||||
if(options.rebaseUrls) {
|
||||
processedCss = processedCss.use(urlPlugin(file.path));
|
||||
}
|
||||
|
||||
processedCss = processedCss.use(collectImportUrls);
|
||||
|
||||
if(options.inlineImports) {
|
||||
processedCss = processedCss.use(reworkImport({
|
||||
path: [
|
||||
'.',
|
||||
path.dirname(file.path)
|
||||
].concat(options.includePaths),
|
||||
transform: processNestedImport
|
||||
}))
|
||||
.toString();
|
||||
}
|
||||
|
||||
processedCss = processedCss.toString();
|
||||
} catch(err) {
|
||||
this.emit('error', new gutil.PluginError('gulp-concat-css', err));
|
||||
return cb();
|
||||
}
|
||||
|
||||
buffer.push(processedCss);
|
||||
cb();
|
||||
}, function(cb) {
|
||||
if(!firstFile) {
|
||||
return cb();
|
||||
}
|
||||
|
||||
var contents = urlImportRules.map(function(rule) {
|
||||
return '@import ' + rule.import + ';';
|
||||
}).concat(buffer).join(gutil.linefeed);
|
||||
|
||||
var concatenatedFile = new gutil.File({
|
||||
base: firstFile.base,
|
||||
cwd: firstFile.cwd,
|
||||
path: path.join(firstFile.base, destFile),
|
||||
contents: new Buffer(contents)
|
||||
});
|
||||
this.push(concatenatedFile);
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
function isUrl(url) {
|
||||
return (/^([\w]+:)?\/\/./).test(url);
|
||||
}
|
||||
|
||||
function isDataURI(url) {
|
||||
return url && url.indexOf('data:') === 0;
|
||||
}
|
||||
22
node_modules/gulp-concat-css/node_modules/lodash.defaults/LICENSE
generated
vendored
Normal file
22
node_modules/gulp-concat-css/node_modules/lodash.defaults/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
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.
|
||||
20
node_modules/gulp-concat-css/node_modules/lodash.defaults/README.md
generated
vendored
Normal file
20
node_modules/gulp-concat-css/node_modules/lodash.defaults/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# lodash.defaults v3.1.2
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.defaults` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash.defaults
|
||||
```
|
||||
|
||||
In Node.js/io.js:
|
||||
|
||||
```js
|
||||
var defaults = require('lodash.defaults');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#defaults) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.defaults) for more details.
|
||||
63
node_modules/gulp-concat-css/node_modules/lodash.defaults/index.js
generated
vendored
Normal file
63
node_modules/gulp-concat-css/node_modules/lodash.defaults/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* lodash 3.1.2 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modern modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
var assign = require('lodash.assign'),
|
||||
restParam = require('lodash.restparam');
|
||||
|
||||
/**
|
||||
* Used by `_.defaults` to customize its `_.assign` use.
|
||||
*
|
||||
* @private
|
||||
* @param {*} objectValue The destination object property value.
|
||||
* @param {*} sourceValue The source object property value.
|
||||
* @returns {*} Returns the value to assign to the destination object.
|
||||
*/
|
||||
function assignDefaults(objectValue, sourceValue) {
|
||||
return objectValue === undefined ? sourceValue : objectValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a `_.defaults` or `_.defaultsDeep` function.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} assigner The function to assign values.
|
||||
* @param {Function} customizer The function to customize assigned values.
|
||||
* @returns {Function} Returns the new defaults function.
|
||||
*/
|
||||
function createDefaults(assigner, customizer) {
|
||||
return restParam(function(args) {
|
||||
var object = args[0];
|
||||
if (object == null) {
|
||||
return object;
|
||||
}
|
||||
args.push(customizer);
|
||||
return assigner.apply(undefined, args);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns own enumerable properties of source object(s) to the destination
|
||||
* object for all destination properties that resolve to `undefined`. Once a
|
||||
* property is set, additional values of the same property are ignored.
|
||||
*
|
||||
* **Note:** This method mutates `object`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The destination object.
|
||||
* @param {...Object} [sources] The source objects.
|
||||
* @returns {Object} Returns `object`.
|
||||
* @example
|
||||
*
|
||||
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
*/
|
||||
var defaults = createDefaults(assign, assignDefaults);
|
||||
|
||||
module.exports = defaults;
|
||||
132
node_modules/gulp-concat-css/node_modules/lodash.defaults/package.json
generated
vendored
Normal file
132
node_modules/gulp-concat-css/node_modules/lodash.defaults/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "lodash.defaults@^3.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "lodash.defaults",
|
||||
"name": "lodash.defaults",
|
||||
"rawSpec": "^3.0.0",
|
||||
"spec": ">=3.0.0 <4.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/Users/jose/Documents/GitHub/Mods/node_modules/gulp-concat-css"
|
||||
]
|
||||
],
|
||||
"_from": "lodash.defaults@>=3.0.0 <4.0.0",
|
||||
"_id": "lodash.defaults@3.1.2",
|
||||
"_inCache": true,
|
||||
"_location": "/gulp-concat-css/lodash.defaults",
|
||||
"_nodeVersion": "0.12.5",
|
||||
"_npmUser": {
|
||||
"name": "jdalton",
|
||||
"email": "john.david.dalton@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.12.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "lodash.defaults@^3.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "lodash.defaults",
|
||||
"name": "lodash.defaults",
|
||||
"rawSpec": "^3.0.0",
|
||||
"spec": ">=3.0.0 <4.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-concat-css"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-3.1.2.tgz",
|
||||
"_shasum": "c7308b18dbf8bc9372d701a73493c61192bd2e2c",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "lodash.defaults@^3.0.0",
|
||||
"_where": "/Users/jose/Documents/GitHub/Mods/node_modules/gulp-concat-css",
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lodash/lodash/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Tan",
|
||||
"email": "demoneaux@gmail.com",
|
||||
"url": "https://d10.github.io/"
|
||||
},
|
||||
{
|
||||
"name": "Blaine Bublitz",
|
||||
"email": "blaine@iceddev.com",
|
||||
"url": "http://www.iceddev.com/"
|
||||
},
|
||||
{
|
||||
"name": "Kit Cambridge",
|
||||
"email": "github@kitcambridge.be",
|
||||
"url": "http://kitcambridge.be/"
|
||||
},
|
||||
{
|
||||
"name": "Mathias Bynens",
|
||||
"email": "mathias@qiwi.be",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"lodash.assign": "^3.0.0",
|
||||
"lodash.restparam": "^3.0.0"
|
||||
},
|
||||
"description": "The modern build of lodash’s `_.defaults` as a module.",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "c7308b18dbf8bc9372d701a73493c61192bd2e2c",
|
||||
"tarball": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-3.1.2.tgz"
|
||||
},
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
"keywords": [
|
||||
"lodash",
|
||||
"lodash-modularized",
|
||||
"stdlib",
|
||||
"util"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jdalton",
|
||||
"email": "john.david.dalton@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "kitcambridge",
|
||||
"email": "github@kitcambridge.be"
|
||||
},
|
||||
{
|
||||
"name": "mathias",
|
||||
"email": "mathias@qiwi.be"
|
||||
},
|
||||
{
|
||||
"name": "phated",
|
||||
"email": "blaine@iceddev.com"
|
||||
},
|
||||
{
|
||||
"name": "d10",
|
||||
"email": "demoneaux@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "lodash.defaults",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lodash/lodash.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\""
|
||||
},
|
||||
"version": "3.1.2"
|
||||
}
|
||||
3
node_modules/gulp-concat-css/node_modules/through2/.npmignore
generated
vendored
Normal file
3
node_modules/gulp-concat-css/node_modules/through2/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
test
|
||||
.jshintrc
|
||||
.travis.yml
|
||||
39
node_modules/gulp-concat-css/node_modules/through2/LICENSE
generated
vendored
Normal file
39
node_modules/gulp-concat-css/node_modules/through2/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
Copyright 2013, Rod Vagg (the "Original Author")
|
||||
All rights reserved.
|
||||
|
||||
MIT +no-false-attribs License
|
||||
|
||||
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.
|
||||
|
||||
Distributions of all or part of the Software intended to be used
|
||||
by the recipients as they would use the unmodified Software,
|
||||
containing modifications that substantially alter, remove, or
|
||||
disable functionality of the Software, outside of the documented
|
||||
configuration mechanisms provided by the Software, shall be
|
||||
modified such that the Original Author's bug reporting email
|
||||
addresses and urls are either replaced with the contact information
|
||||
of the parties responsible for the changes, or removed entirely.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Except where noted, this license applies to any and all software
|
||||
programs and associated documentation files created by the
|
||||
Original Author, when distributed with the Software.
|
||||
142
node_modules/gulp-concat-css/node_modules/through2/README.md
generated
vendored
Normal file
142
node_modules/gulp-concat-css/node_modules/through2/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
# through2
|
||||
|
||||
<!--
|
||||
|
||||
soon ...
|
||||
|
||||
[](http://travis-ci.org/rvagg/through2)
|
||||
|
||||
[](https://travis-ci.org/rvagg/through2)
|
||||
|
||||
-->
|
||||
|
||||
[](https://nodei.co/npm/through2/)
|
||||
|
||||
<!--
|
||||
not happy with these, we need to peg to readable-stream@1.0.x so it'll always report out-of-date
|
||||
|
||||
[](https://david-dm.org/rvagg/through2/)
|
||||
[](https://david-dm.org/rvagg/through2#info=devDependencies/)
|
||||
-->
|
||||
|
||||
**A tiny wrapper around Node streams.Transform (Streams2) to avoid explicit subclassing noise**
|
||||
|
||||
Inspired by [Dominic Tarr](https://github.com/dominictarr)'s [through](https://github.com/dominictarr/through) in that it's so much easier to make a stream out of a function than it is to set up the prototype chain properly: `through(function (chunk) { ... })`.
|
||||
|
||||
Note: A **Streams3** version of through2 is available in npm with the tag `"1.0"` rather than `"latest"` so an `npm install through2` will get you the current Streams2 version (version number is 0.x.x). To use a Streams3 version use `npm install through2@1` to fetch the latest version 1.x.x. More information about Streams2 vs Streams3 and recommendations [here](http://www.nearform.com/nodecrunch/dont-use-nodes-core-stream-module).
|
||||
|
||||
```js
|
||||
fs.createReadStream('ex.txt')
|
||||
.pipe(through2(function (chunk, enc, callback) {
|
||||
|
||||
for (var i = 0; i < chunk.length; i++)
|
||||
if (chunk[i] == 97)
|
||||
chunk[i] = 122 // swap 'a' for 'z'
|
||||
|
||||
this.push(chunk)
|
||||
|
||||
callback()
|
||||
|
||||
}))
|
||||
.pipe(fs.createWriteStream('out.txt'))
|
||||
```
|
||||
|
||||
Or object streams:
|
||||
|
||||
```js
|
||||
var all = []
|
||||
|
||||
fs.createReadStream('data.csv')
|
||||
.pipe(csv2())
|
||||
.pipe(through2.obj(function (chunk, enc, callback) {
|
||||
|
||||
var data = {
|
||||
name : chunk[0]
|
||||
, address : chunk[3]
|
||||
, phone : chunk[10]
|
||||
}
|
||||
|
||||
this.push(data)
|
||||
|
||||
callback()
|
||||
|
||||
}))
|
||||
.on('data', function (data) {
|
||||
all.push(data)
|
||||
})
|
||||
.on('end', function () {
|
||||
doSomethingSpecial(all)
|
||||
})
|
||||
```
|
||||
|
||||
Note that `through2.obj(fn)` is a convenience wrapper around `through2({ objectMode: true }, fn)`.
|
||||
|
||||
## API
|
||||
|
||||
<b><code>through2([ options, ] [ transformFunction ] [, flushFunction ])</code></b>
|
||||
|
||||
Consult the **[stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)** documentation for the exact rules of the `transformFunction` (i.e. `this._transform`) and the optional `flushFunction` (i.e. `this._flush`).
|
||||
|
||||
### options
|
||||
|
||||
The options argument is optional and is passed straight through to `stream.Transform`. So you can use `objectMode:true` if you are processing non-binary streams (or just use `through2.obj()`).
|
||||
|
||||
The `options` argument is first, unlike standard convention, because if I'm passing in an anonymous function then I'd prefer for the options argument to not get lost at the end of the call:
|
||||
|
||||
```js
|
||||
fs.createReadStream('/tmp/important.dat')
|
||||
.pipe(through2({ objectMode: true, allowHalfOpen: false }, function (chunk, enc, cb) {
|
||||
|
||||
this.push(new Buffer('wut?'))
|
||||
cb()
|
||||
|
||||
})
|
||||
.pipe(fs.createWriteStream('/tmp/wut.txt'))
|
||||
```
|
||||
|
||||
### transformFunction
|
||||
|
||||
The `transformFunction` must have the following signature: `function (chunk, encoding, callback) {}`. A minimal implementation should call the `callback` function to indicate that the transformation is done, even if that transformation means discarding the chunk.
|
||||
|
||||
To queue a new chunk, call `this.push(chunk)`—this can be called as many times as required before the `callback()` if you have multiple pieces to send on.
|
||||
|
||||
Alternatively, you may use `callback(err, chunk)` as shorthand for emitting a single chunk or an error.
|
||||
|
||||
If you **do not provide a `transformFunction`** then you will get a simple pass-through stream.
|
||||
|
||||
### flushFunction
|
||||
|
||||
The optional `flushFunction` is provided as the last argument (2nd or 3rd, depending on whether you've supplied options) is called just prior to the stream ending. Can be used to finish up any processing that may be in progress.
|
||||
|
||||
<b><code>through2.ctor([ options, ] transformFunction[, flushFunction ])</code></b>
|
||||
|
||||
Instead of returning a `stream.Transform` instance, `through2.ctor()` returns a **constructor** for a custom Transform. This is useful when you want to use the same transform logic in multiple instances.
|
||||
|
||||
```js
|
||||
var FToC = through2.ctor({objectMode: true}, function (record, encoding, callback) {
|
||||
if (record.temp != null && record.unit = "F") {
|
||||
record.temp = ( ( record.temp - 32 ) * 5 ) / 9
|
||||
record.unit = "C"
|
||||
}
|
||||
this.push(record)
|
||||
callback()
|
||||
})
|
||||
|
||||
// Create instances of FToC like so:
|
||||
var converter = new FToC()
|
||||
// Or:
|
||||
var converter = FToC()
|
||||
// Or specify/override options when you instantiate, if you prefer:
|
||||
var converter = FToC({objectMode: true})
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- [through2-map](https://github.com/brycebaril/through2-map) - Array.prototype.map analog for streams.
|
||||
- [through2-filter](https://github.com/brycebaril/through2-filter) - Array.prototype.filter analog for streams.
|
||||
- [through2-reduce](https://github.com/brycebaril/through2-reduce) - Array.prototype.reduce analog for streams.
|
||||
- [through2-spy](https://github.com/brycebaril/through2-spy) - Wrapper for simple stream.PassThrough spies.
|
||||
|
||||
## License
|
||||
|
||||
**through2** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
|
||||
101
node_modules/gulp-concat-css/node_modules/through2/package.json
generated
vendored
Normal file
101
node_modules/gulp-concat-css/node_modules/through2/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "through2@~1.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "through2",
|
||||
"name": "through2",
|
||||
"rawSpec": "~1.1.1",
|
||||
"spec": ">=1.1.1 <1.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/Users/jose/Documents/GitHub/Mods/node_modules/gulp-concat-css"
|
||||
]
|
||||
],
|
||||
"_from": "through2@>=1.1.1 <1.2.0",
|
||||
"_id": "through2@1.1.1",
|
||||
"_inCache": true,
|
||||
"_location": "/gulp-concat-css/through2",
|
||||
"_npmUser": {
|
||||
"name": "rvagg",
|
||||
"email": "rod@vagg.org"
|
||||
},
|
||||
"_npmVersion": "1.4.21",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "through2@~1.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "through2",
|
||||
"name": "through2",
|
||||
"rawSpec": "~1.1.1",
|
||||
"spec": ">=1.1.1 <1.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-concat-css"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/through2/-/through2-1.1.1.tgz",
|
||||
"_shasum": "0847cbc4449f3405574dbdccd9bb841b83ac3545",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "through2@~1.1.1",
|
||||
"_where": "/Users/jose/Documents/GitHub/Mods/node_modules/gulp-concat-css",
|
||||
"author": {
|
||||
"name": "Rod Vagg",
|
||||
"email": "r@va.gg",
|
||||
"url": "https://github.com/rvagg"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/rvagg/through2/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"readable-stream": ">=1.1.13-1 <1.2.0-0",
|
||||
"xtend": ">=4.0.0 <4.1.0-0"
|
||||
},
|
||||
"description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise",
|
||||
"devDependencies": {
|
||||
"bl": ">=0.9.0 <0.10.0-0",
|
||||
"stream-spigot": ">=3.0.4 <3.1.0-0",
|
||||
"tape": ">=2.14.0 <2.15.0-0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0847cbc4449f3405574dbdccd9bb841b83ac3545",
|
||||
"tarball": "https://registry.npmjs.org/through2/-/through2-1.1.1.tgz"
|
||||
},
|
||||
"gitHead": "05618510052dcb4ec970c47c1234e0fcad8566de",
|
||||
"homepage": "https://github.com/rvagg/through2",
|
||||
"keywords": [
|
||||
"stream",
|
||||
"streams2",
|
||||
"through",
|
||||
"transform"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "through2.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "rvagg",
|
||||
"email": "rod@vagg.org"
|
||||
},
|
||||
{
|
||||
"name": "bryce",
|
||||
"email": "bryce@ravenwall.com"
|
||||
}
|
||||
],
|
||||
"name": "through2",
|
||||
"optionalDependencies": {},
|
||||
"publishConfig": {
|
||||
"tag": "1.0"
|
||||
},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/rvagg/through2.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/test.js",
|
||||
"test-local": "brtapsauce-local test/basic-test.js"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
}
|
||||
96
node_modules/gulp-concat-css/node_modules/through2/through2.js
generated
vendored
Normal file
96
node_modules/gulp-concat-css/node_modules/through2/through2.js
generated
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
var Transform = require('readable-stream/transform')
|
||||
, inherits = require('util').inherits
|
||||
, xtend = require('xtend')
|
||||
|
||||
function DestroyableTransform(opts) {
|
||||
Transform.call(this, opts)
|
||||
this._destroyed = false
|
||||
}
|
||||
|
||||
inherits(DestroyableTransform, Transform)
|
||||
|
||||
DestroyableTransform.prototype.destroy = function(err) {
|
||||
if (this._destroyed) return
|
||||
this._destroyed = true
|
||||
|
||||
var self = this
|
||||
process.nextTick(function() {
|
||||
if (err)
|
||||
self.emit('error', err)
|
||||
self.emit('close')
|
||||
})
|
||||
}
|
||||
|
||||
// a noop _transform function
|
||||
function noop (chunk, enc, callback) {
|
||||
callback(null, chunk)
|
||||
}
|
||||
|
||||
|
||||
// create a new export function, used by both the main export and
|
||||
// the .ctor export, contains common logic for dealing with arguments
|
||||
function through2 (construct) {
|
||||
return function (options, transform, flush) {
|
||||
if (typeof options == 'function') {
|
||||
flush = transform
|
||||
transform = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
if (typeof transform != 'function')
|
||||
transform = noop
|
||||
|
||||
if (typeof flush != 'function')
|
||||
flush = null
|
||||
|
||||
return construct(options, transform, flush)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// main export, just make me a transform stream!
|
||||
module.exports = through2(function (options, transform, flush) {
|
||||
var t2 = new DestroyableTransform(options)
|
||||
|
||||
t2._transform = transform
|
||||
|
||||
if (flush)
|
||||
t2._flush = flush
|
||||
|
||||
return t2
|
||||
})
|
||||
|
||||
|
||||
// make me a reusable prototype that I can `new`, or implicitly `new`
|
||||
// with a constructor call
|
||||
module.exports.ctor = through2(function (options, transform, flush) {
|
||||
function Through2 (override) {
|
||||
if (!(this instanceof Through2))
|
||||
return new Through2(override)
|
||||
|
||||
this.options = xtend(options, override)
|
||||
|
||||
DestroyableTransform.call(this, this.options)
|
||||
}
|
||||
|
||||
inherits(Through2, DestroyableTransform)
|
||||
|
||||
Through2.prototype._transform = transform
|
||||
|
||||
if (flush)
|
||||
Through2.prototype._flush = flush
|
||||
|
||||
return Through2
|
||||
})
|
||||
|
||||
|
||||
module.exports.obj = through2(function (options, transform, flush) {
|
||||
var t2 = new DestroyableTransform(xtend({ objectMode: true, highWaterMark: 16 }, options))
|
||||
|
||||
t2._transform = transform
|
||||
|
||||
if (flush)
|
||||
t2._flush = flush
|
||||
|
||||
return t2
|
||||
})
|
||||
111
node_modules/gulp-concat-css/package.json
generated
vendored
Normal file
111
node_modules/gulp-concat-css/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "gulp-concat-css@^2.3.0",
|
||||
"scope": null,
|
||||
"escapedName": "gulp-concat-css",
|
||||
"name": "gulp-concat-css",
|
||||
"rawSpec": "^2.3.0",
|
||||
"spec": ">=2.3.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/Users/jose/Documents/GitHub/Mods/node_modules/semantic-ui"
|
||||
]
|
||||
],
|
||||
"_from": "gulp-concat-css@>=2.3.0 <3.0.0",
|
||||
"_id": "gulp-concat-css@2.3.0",
|
||||
"_inCache": true,
|
||||
"_location": "/gulp-concat-css",
|
||||
"_nodeVersion": "4.2.6",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/gulp-concat-css-2.3.0.tgz_1463480630688_0.9583744644187391"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "mariocasciaro",
|
||||
"email": "contact@mariocasciaro.me"
|
||||
},
|
||||
"_npmVersion": "2.14.12",
|
||||
"_phantomChildren": {
|
||||
"lodash.assign": "3.2.0",
|
||||
"lodash.restparam": "3.6.1",
|
||||
"readable-stream": "1.1.14",
|
||||
"xtend": "4.0.1"
|
||||
},
|
||||
"_requested": {
|
||||
"raw": "gulp-concat-css@^2.3.0",
|
||||
"scope": null,
|
||||
"escapedName": "gulp-concat-css",
|
||||
"name": "gulp-concat-css",
|
||||
"rawSpec": "^2.3.0",
|
||||
"spec": ">=2.3.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/semantic-ui"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gulp-concat-css/-/gulp-concat-css-2.3.0.tgz",
|
||||
"_shasum": "4c1586121a8411ff4b2dc44fcfa4dc740e8fe1b6",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "gulp-concat-css@^2.3.0",
|
||||
"_where": "/Users/jose/Documents/GitHub/Mods/node_modules/semantic-ui",
|
||||
"author": {
|
||||
"name": "Mario Casciaro"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mariocasciaro/gulp-concat-css/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"gulp-util": "~3.0.1",
|
||||
"lodash.defaults": "^3.0.0",
|
||||
"parse-import": "^2.0.0",
|
||||
"rework": "~1.0.0",
|
||||
"rework-import": "^2.0.0",
|
||||
"rework-plugin-url": "^1.0.1",
|
||||
"through2": "~1.1.1"
|
||||
},
|
||||
"description": "Concatenate css files, rebasing urls and inlining @import",
|
||||
"devDependencies": {
|
||||
"chai": "^1.10.0",
|
||||
"mocha": "^2.1.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "4c1586121a8411ff4b2dc44fcfa4dc740e8fe1b6",
|
||||
"tarball": "https://registry.npmjs.org/gulp-concat-css/-/gulp-concat-css-2.3.0.tgz"
|
||||
},
|
||||
"gitHead": "c4171769510e6921b7c33610acfb6fd6a42237be",
|
||||
"homepage": "https://github.com/mariocasciaro/gulp-concat-css",
|
||||
"keywords": [
|
||||
"gulpplugin",
|
||||
"concat",
|
||||
"css",
|
||||
"import",
|
||||
"merge",
|
||||
"inline"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/mariocasciaro/gulp-concat-css/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "mariocasciaro",
|
||||
"email": "mariocasciaro@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "gulp-concat-css",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mariocasciaro/gulp-concat-css.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node_modules/mocha/bin/mocha test/*.js --reporter spec"
|
||||
},
|
||||
"version": "2.3.0"
|
||||
}
|
||||
36
node_modules/gulp-concat-css/test/expected/build/bundle-all.css
generated
vendored
Normal file
36
node_modules/gulp-concat-css/test/expected/build/bundle-all.css
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
@import url(http://fonts.googleapis.com/css);
|
||||
@import url("//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic");
|
||||
@font-face {
|
||||
font-family: 'Font';
|
||||
src: url("../lib/fonts/webfont.eot");
|
||||
}
|
||||
|
||||
.navbar-header-2 {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.navbar-header:after {
|
||||
clear: both;
|
||||
background: url("data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/") no-repeat left center;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.navbar-header {
|
||||
background: url("data:image/png;base64,iVBORwJggg==") no-repeat scroll 100% 50% rgba(0, 0, 0, 0);
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font';
|
||||
src: url("../lib/fonts/webfont.eot?v=4.0.0");
|
||||
src: url("../lib/fonts/webfont.eot");
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Font1';
|
||||
src: url("../lib/fonts/webfont.eot");
|
||||
}
|
||||
|
||||
.navbar-header {
|
||||
clear: both;
|
||||
}
|
||||
15
node_modules/gulp-concat-css/test/expected/build/bundle-bubbleonly.css
generated
vendored
Normal file
15
node_modules/gulp-concat-css/test/expected/build/bundle-bubbleonly.css
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
@import url('subdir/imported.css');
|
||||
@import url("//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic");
|
||||
@font-face {
|
||||
font-family: 'Font';
|
||||
src: url('lib/fonts/webfont.eot?v=4.0.0');
|
||||
src: url('lib/fonts/webfont.eot');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Font1';
|
||||
src: url('../lib/fonts/webfont.eot');
|
||||
}
|
||||
|
||||
.navbar-header {
|
||||
clear: both;
|
||||
}
|
||||
36
node_modules/gulp-concat-css/test/expected/build/bundle-import.css
generated
vendored
Normal file
36
node_modules/gulp-concat-css/test/expected/build/bundle-import.css
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
@import url(http://fonts.googleapis.com/css);
|
||||
@import url("//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic");
|
||||
@font-face {
|
||||
font-family: 'Font';
|
||||
src: url('../lib/fonts/webfont.eot');
|
||||
}
|
||||
|
||||
.navbar-header-2 {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.navbar-header:after {
|
||||
clear: both;
|
||||
background: url(data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/) no-repeat left center;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.navbar-header {
|
||||
background: url('data:image/png;base64,iVBORwJggg==') no-repeat scroll 100% 50% rgba(0, 0, 0, 0);
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font';
|
||||
src: url('lib/fonts/webfont.eot?v=4.0.0');
|
||||
src: url('lib/fonts/webfont.eot');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Font1';
|
||||
src: url('../lib/fonts/webfont.eot');
|
||||
}
|
||||
|
||||
.navbar-header {
|
||||
clear: both;
|
||||
}
|
||||
15
node_modules/gulp-concat-css/test/expected/build/bundle-rebase.css
generated
vendored
Normal file
15
node_modules/gulp-concat-css/test/expected/build/bundle-rebase.css
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
@import url('subdir/imported.css');
|
||||
@import url("//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic");
|
||||
@font-face {
|
||||
font-family: 'Font';
|
||||
src: url("../lib/fonts/webfont.eot?v=4.0.0");
|
||||
src: url("../lib/fonts/webfont.eot");
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Font1';
|
||||
src: url("../lib/fonts/webfont.eot");
|
||||
}
|
||||
|
||||
.navbar-header {
|
||||
clear: both;
|
||||
}
|
||||
7
node_modules/gulp-concat-css/test/fixtures/main.css
generated
vendored
Normal file
7
node_modules/gulp-concat-css/test/fixtures/main.css
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@import url('subdir/imported.css');
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font';
|
||||
src: url('lib/fonts/webfont.eot?v=4.0.0');
|
||||
src: url('lib/fonts/webfont.eot');
|
||||
}
|
||||
17
node_modules/gulp-concat-css/test/fixtures/subdir/imported.css
generated
vendored
Normal file
17
node_modules/gulp-concat-css/test/fixtures/subdir/imported.css
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@font-face {
|
||||
font-family: 'Font';
|
||||
src: url('../lib/fonts/webfont.eot');
|
||||
}
|
||||
|
||||
@import url("../vendor/importedRecursive.css");
|
||||
|
||||
.navbar-header:after {
|
||||
clear: both;
|
||||
background: url(data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/) no-repeat left center;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.navbar-header {
|
||||
background: url('data:image/png;base64,iVBORwJggg==') no-repeat scroll 100% 50% rgba(0, 0, 0, 0);
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
5
node_modules/gulp-concat-css/test/fixtures/vendor/importedRecursive.css
generated
vendored
Normal file
5
node_modules/gulp-concat-css/test/fixtures/vendor/importedRecursive.css
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@import url(http://fonts.googleapis.com/css);
|
||||
|
||||
.navbar-header-2 {
|
||||
clear: both;
|
||||
}
|
||||
11
node_modules/gulp-concat-css/test/fixtures/vendor/vendor.css
generated
vendored
Normal file
11
node_modules/gulp-concat-css/test/fixtures/vendor/vendor.css
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
@import url("//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic");
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font1';
|
||||
src: url('../lib/fonts/webfont.eot');
|
||||
}
|
||||
|
||||
|
||||
.navbar-header {
|
||||
clear: both;
|
||||
}
|
||||
130
node_modules/gulp-concat-css/test/test.js
generated
vendored
Normal file
130
node_modules/gulp-concat-css/test/test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
var expect = require('chai').expect,
|
||||
through = require('through2'),
|
||||
gutil = require('gulp-util'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
concatCss = require('../');
|
||||
|
||||
|
||||
function expected(file) {
|
||||
var base = path.join(process.cwd(), 'test/expected');
|
||||
var filepath = path.resolve(base, file);
|
||||
return new gutil.File({
|
||||
path: filepath,
|
||||
cwd: process.cwd(),
|
||||
base: base,
|
||||
contents: fs.readFileSync(filepath)
|
||||
});
|
||||
}
|
||||
|
||||
function fixture(file) {
|
||||
var base = path.join(process.cwd(), 'test/fixtures');
|
||||
var filepath = path.join(base, file);
|
||||
return new gutil.File({
|
||||
path: filepath,
|
||||
cwd: process.cwd(),
|
||||
base: base,
|
||||
contents: fs.readFileSync(filepath)
|
||||
});
|
||||
}
|
||||
|
||||
describe('gulp-concat-css', function() {
|
||||
it('should only bubble up imports', function(done) {
|
||||
var now = Date.now();
|
||||
var stream = concatCss('build/bundle-bubbleonly.css', {inlineImports: false, rebaseUrls: false});
|
||||
var expectedFile = expected('build/bundle-bubbleonly.css');
|
||||
stream
|
||||
.pipe(through.obj(function(file, enc, cb) {
|
||||
//fs.writeFileSync("bundle.css", file.contents);
|
||||
|
||||
expect(String(file.contents)).to.be.equal(String(expectedFile.contents));
|
||||
expect(path.basename(file.path)).to.be.equal(path.basename(expectedFile.path));
|
||||
expect(file.cwd, "cwd").to.be.equal(expectedFile.cwd);
|
||||
expect(file.relative, "relative").to.be.equal(expectedFile.relative);
|
||||
console.log('Execution time: ' + (Date.now() - now) + 'ms');
|
||||
done();
|
||||
}));
|
||||
|
||||
stream.write(fixture('main.css'));
|
||||
stream.write(fixture('vendor/vendor.css'));
|
||||
stream.end();
|
||||
});
|
||||
|
||||
it('should only rebase urls', function(done) {
|
||||
var now = Date.now();
|
||||
var stream = concatCss('build/bundle-rebase.css', {inlineImports: false});
|
||||
var expectedFile = expected('build/bundle-rebase.css');
|
||||
stream
|
||||
.pipe(through.obj(function(file, enc, cb) {
|
||||
//fs.writeFileSync("bundle.css", file.contents);
|
||||
|
||||
expect(String(file.contents)).to.be.equal(String(expectedFile.contents));
|
||||
expect(path.basename(file.path)).to.be.equal(path.basename(expectedFile.path));
|
||||
expect(file.cwd, "cwd").to.be.equal(expectedFile.cwd);
|
||||
expect(file.relative, "relative").to.be.equal(expectedFile.relative);
|
||||
console.log('Execution time: ' + (Date.now() - now) + 'ms');
|
||||
done();
|
||||
}));
|
||||
|
||||
stream.write(fixture('main.css'));
|
||||
stream.write(fixture('vendor/vendor.css'));
|
||||
stream.end();
|
||||
});
|
||||
|
||||
|
||||
it('should only inline imports', function(done) {
|
||||
var now = Date.now();
|
||||
var stream = concatCss('build/bundle-import.css', {inlineImports: true, rebaseUrls: false});
|
||||
var expectedFile = expected('build/bundle-import.css');
|
||||
stream
|
||||
.pipe(through.obj(function(file, enc, cb) {
|
||||
//fs.writeFileSync("bundle.css", file.contents);
|
||||
|
||||
expect(String(file.contents)).to.be.equal(String(expectedFile.contents));
|
||||
expect(path.basename(file.path)).to.be.equal(path.basename(expectedFile.path));
|
||||
expect(file.cwd, "cwd").to.be.equal(expectedFile.cwd);
|
||||
expect(file.relative, "relative").to.be.equal(expectedFile.relative);
|
||||
console.log('Execution time: ' + (Date.now() - now) + 'ms');
|
||||
done();
|
||||
}));
|
||||
|
||||
stream.write(fixture('main.css'));
|
||||
stream.write(fixture('vendor/vendor.css'));
|
||||
stream.end();
|
||||
});
|
||||
|
||||
it('should concat, rebase urls, inline imports and bubble up external imports', function(done) {
|
||||
var now = Date.now();
|
||||
var stream = concatCss('build/bundle-all.css');
|
||||
var expectedFile = expected('build/bundle-all.css');
|
||||
stream
|
||||
.pipe(through.obj(function(file, enc, cb) {
|
||||
//fs.writeFileSync("bundle.css", file.contents);
|
||||
expect(String(file.contents)).to.be.equal(String(expectedFile.contents));
|
||||
expect(path.basename(file.path)).to.be.equal(path.basename(expectedFile.path));
|
||||
expect(file.cwd, "cwd").to.be.equal(expectedFile.cwd);
|
||||
expect(file.relative, "relative").to.be.equal(expectedFile.relative);
|
||||
console.log('Execution time: ' + (Date.now() - now) + 'ms');
|
||||
done();
|
||||
}));
|
||||
|
||||
stream.write(fixture('main.css'));
|
||||
stream.write(fixture('vendor/vendor.css'));
|
||||
stream.end();
|
||||
});
|
||||
|
||||
it('should not crash if no file is provided', function(done) {
|
||||
var stream = concatCss('build/bundle-all.css');
|
||||
stream
|
||||
.on('error', function() {
|
||||
done(false);
|
||||
})
|
||||
.pipe(through.obj(function(file, enc, cb) {
|
||||
done(false);
|
||||
}, function() {
|
||||
done();
|
||||
}));
|
||||
|
||||
stream.end();
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue