install gulp
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
const fancyLog = require('fancy-log');
|
||||
const PluginError = require('plugin-error');
|
||||
const through = require('through2');
|
||||
const applySourceMap = require('vinyl-sourcemaps-apply');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
const postcss = require('postcss');
|
||||
|
||||
module.exports = opts => {
|
||||
return through.obj((file, enc, cb) => {
|
||||
if (file.isNull()) {
|
||||
cb(null, file);
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.isStream()) {
|
||||
cb(new PluginError('gulp-autoprefixer', 'Streaming not supported'));
|
||||
return;
|
||||
}
|
||||
|
||||
postcss(autoprefixer(opts)).process(file.contents.toString(), {
|
||||
map: file.sourceMap ? {annotation: false} : false,
|
||||
from: file.path,
|
||||
to: file.path
|
||||
}).then(res => {
|
||||
file.contents = Buffer.from(res.css);
|
||||
|
||||
if (res.map && file.sourceMap) {
|
||||
const map = res.map.toJSON();
|
||||
map.file = file.relative;
|
||||
map.sources = map.sources.map(() => file.relative);
|
||||
applySourceMap(file, map);
|
||||
}
|
||||
|
||||
const warnings = res.warnings();
|
||||
|
||||
if (warnings.length > 0) {
|
||||
fancyLog('gulp-autoprefixer:', '\n ' + warnings.join('\n '));
|
||||
}
|
||||
|
||||
setImmediate(cb, null, file);
|
||||
}).catch(err => {
|
||||
const cssError = err.name === 'CssSyntaxError';
|
||||
|
||||
if (cssError) {
|
||||
err.message += err.showSourceCode();
|
||||
}
|
||||
|
||||
// Prevent stream unhandled exception from being suppressed by Promise
|
||||
setImmediate(cb, new PluginError('gulp-autoprefixer', err, {
|
||||
fileName: file.path,
|
||||
showStack: !cssError
|
||||
}));
|
||||
});
|
||||
});
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Blaine Bublitz <blaine.bublitz@gmail.com>
|
||||
Based on gulp-util, copyright 2014 Fractal <contact@wearefractal.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.
|
||||
|
||||
Generated
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
# fancy-log
|
||||
|
||||
[](https://travis-ci.org/js-cli/fancy-log)
|
||||
|
||||
Log things, prefixed with a timestamp
|
||||
|
||||
__This module was pulled out of gulp-util for use inside the CLI__
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var log = require('fancy-log');
|
||||
|
||||
log('a message');
|
||||
// [16:27:02] a message
|
||||
|
||||
log.error('oh no!');
|
||||
// [16:27:02] oh no!
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `log(msg...)`
|
||||
|
||||
Logs the message as if you called `console.log` but prefixes the output with the
|
||||
current time in HH:MM:ss format.
|
||||
|
||||
### `log.error(msg...)`
|
||||
|
||||
Logs the message as if you called `console.error` but prefixes the output with the
|
||||
current time in HH:MM:ss format.
|
||||
|
||||
### `log.warn(msg...)`
|
||||
|
||||
Logs the message as if you called `console.warn` but prefixes the output with the
|
||||
current time in HH:MM:ss format.
|
||||
|
||||
|
||||
### `log.info(msg...)`
|
||||
|
||||
Logs the message as if you called `console.info` but prefixes the output with the
|
||||
current time in HH:MM:ss format.
|
||||
|
||||
### `log.dir(msg...)`
|
||||
|
||||
Logs the message as if you called `console.dir` but prefixes the output with the
|
||||
current time in HH:MM:ss format.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Generated
Vendored
+72
@@ -0,0 +1,72 @@
|
||||
'use strict';
|
||||
/*
|
||||
Initial code from https://github.com/gulpjs/gulp-util/blob/v3.0.6/lib/log.js
|
||||
*/
|
||||
var gray = require('ansi-gray');
|
||||
var timestamp = require('time-stamp');
|
||||
var supportsColor = require('color-support');
|
||||
|
||||
function hasFlag(flag) {
|
||||
return (process.argv.indexOf('--' + flag) !== -1);
|
||||
}
|
||||
|
||||
function addColor(str) {
|
||||
if (hasFlag('no-color')) {
|
||||
return str;
|
||||
}
|
||||
|
||||
if (hasFlag('color')) {
|
||||
return gray(str);
|
||||
}
|
||||
|
||||
if (supportsColor()) {
|
||||
return gray(str);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function getTimestamp(){
|
||||
return '['+addColor(timestamp('HH:mm:ss'))+']';
|
||||
}
|
||||
|
||||
function log(){
|
||||
var time = getTimestamp();
|
||||
process.stdout.write(time + ' ');
|
||||
console.log.apply(console, arguments);
|
||||
return this;
|
||||
}
|
||||
|
||||
function info(){
|
||||
var time = getTimestamp();
|
||||
process.stdout.write(time + ' ');
|
||||
console.info.apply(console, arguments);
|
||||
return this;
|
||||
}
|
||||
|
||||
function dir(){
|
||||
var time = getTimestamp();
|
||||
process.stdout.write(time + ' ');
|
||||
console.dir.apply(console, arguments);
|
||||
return this;
|
||||
}
|
||||
|
||||
function warn(){
|
||||
var time = getTimestamp();
|
||||
process.stderr.write(time + ' ');
|
||||
console.warn.apply(console, arguments);
|
||||
return this;
|
||||
}
|
||||
|
||||
function error(){
|
||||
var time = getTimestamp();
|
||||
process.stderr.write(time + ' ');
|
||||
console.error.apply(console, arguments);
|
||||
return this;
|
||||
}
|
||||
|
||||
module.exports = log;
|
||||
module.exports.info = info;
|
||||
module.exports.dir = dir;
|
||||
module.exports.warn = warn;
|
||||
module.exports.error = error;
|
||||
Generated
Vendored
+81
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"_from": "fancy-log@^1.3.2",
|
||||
"_id": "fancy-log@1.3.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=",
|
||||
"_location": "/gulp-autoprefixer/fancy-log",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "fancy-log@^1.3.2",
|
||||
"name": "fancy-log",
|
||||
"escapedName": "fancy-log",
|
||||
"rawSpec": "^1.3.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.3.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-autoprefixer"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.2.tgz",
|
||||
"_shasum": "f41125e3d84f2e7d89a43d06d958c8f78be16be1",
|
||||
"_spec": "fancy-log@^1.3.2",
|
||||
"_where": "/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah/node_modules/gulp-autoprefixer",
|
||||
"author": {
|
||||
"name": "Blaine Bublitz",
|
||||
"email": "blaine.bublitz@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/js-cli/fancy-log/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Aman Mittal",
|
||||
"url": "http://amandeepmittal.github.io/"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-gray": "^0.1.1",
|
||||
"color-support": "^1.1.3",
|
||||
"time-stamp": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Log things, prefixed with a timestamp",
|
||||
"devDependencies": {
|
||||
"@phated/eslint-config-iceddev": "^0.2.1",
|
||||
"code": "^1.5.0",
|
||||
"eslint": "^1.3.1",
|
||||
"eslint-plugin-mocha": "^0.5.1",
|
||||
"eslint-plugin-react": "^3.3.1",
|
||||
"lab": "^5.16.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/js-cli/fancy-log#readme",
|
||||
"keywords": [
|
||||
"console.log",
|
||||
"log",
|
||||
"logger",
|
||||
"logging",
|
||||
"pretty",
|
||||
"timestamp"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "fancy-log",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/js-cli/fancy-log.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -cvL test.js"
|
||||
},
|
||||
"version": "1.3.2"
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"_from": "gulp-autoprefixer@latest",
|
||||
"_id": "gulp-autoprefixer@5.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-gjfCeKaXdScKHK/n1vEBz81YVUQ=",
|
||||
"_location": "/gulp-autoprefixer",
|
||||
"_phantomChildren": {
|
||||
"ansi-gray": "0.1.1",
|
||||
"color-support": "1.1.3",
|
||||
"time-stamp": "1.1.0"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "gulp-autoprefixer@latest",
|
||||
"name": "gulp-autoprefixer",
|
||||
"escapedName": "gulp-autoprefixer",
|
||||
"rawSpec": "latest",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/",
|
||||
"#USER"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gulp-autoprefixer/-/gulp-autoprefixer-5.0.0.tgz",
|
||||
"_shasum": "8237c278a69775270a1cafe7d6f101cfcd585544",
|
||||
"_spec": "gulp-autoprefixer@latest",
|
||||
"_where": "/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/gulp-autoprefixer/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"autoprefixer": "^8.0.0",
|
||||
"fancy-log": "^1.3.2",
|
||||
"plugin-error": "^1.0.1",
|
||||
"postcss": "^6.0.1",
|
||||
"through2": "^2.0.0",
|
||||
"vinyl-sourcemaps-apply": "^0.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Prefix CSS",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"gulp-sourcemaps": "^2.6.0",
|
||||
"p-event": "^1.1.0",
|
||||
"vinyl": "^2.1.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.5"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/gulp-autoprefixer#readme",
|
||||
"keywords": [
|
||||
"gulpplugin",
|
||||
"autoprefixer",
|
||||
"postcss",
|
||||
"css",
|
||||
"prefix",
|
||||
"prefixes",
|
||||
"stylesheet",
|
||||
"preprocess",
|
||||
"postcss-runner"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "gulp-autoprefixer",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/gulp-autoprefixer.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "5.0.0"
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
# gulp-autoprefixer [](https://travis-ci.org/sindresorhus/gulp-autoprefixer)
|
||||
|
||||
> Prefix CSS with [Autoprefixer](https://github.com/postcss/autoprefixer)
|
||||
|
||||
*Issues with the output should be reported on the Autoprefixer [issue tracker](https://github.com/postcss/autoprefixer/issues).*
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save-dev gulp-autoprefixer
|
||||
```
|
||||
|
||||
<a href="https://www.patreon.com/sindresorhus">
|
||||
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
|
||||
</a>
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const gulp = require('gulp');
|
||||
const autoprefixer = require('gulp-autoprefixer');
|
||||
|
||||
gulp.task('default', () =>
|
||||
gulp.src('src/app.css')
|
||||
.pipe(autoprefixer({
|
||||
browsers: ['last 2 versions'],
|
||||
cascade: false
|
||||
}))
|
||||
.pipe(gulp.dest('dist'))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### autoprefixer([options])
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
See the Autoprefixer [options](https://github.com/postcss/autoprefixer#options).
|
||||
|
||||
|
||||
## Source Maps
|
||||
|
||||
Use [gulp-sourcemaps](https://github.com/gulp-sourcemaps/gulp-sourcemaps) like this:
|
||||
|
||||
```js
|
||||
const gulp = require('gulp');
|
||||
const sourcemaps = require('gulp-sourcemaps');
|
||||
const autoprefixer = require('gulp-autoprefixer');
|
||||
const concat = require('gulp-concat');
|
||||
|
||||
gulp.task('default', () =>
|
||||
gulp.src('src/**/*.css')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(autoprefixer())
|
||||
.pipe(concat('all.css'))
|
||||
.pipe(sourcemaps.write('.'))
|
||||
.pipe(gulp.dest('dist'))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
## Tip
|
||||
|
||||
If you use other PostCSS based tools, like `cssnano`, you may want to run them together using [`gulp-postcss`](https://github.com/postcss/autoprefixer#gulp) instead of `gulp-autoprefixer`. It will be faster, as the CSS is parsed only once for all PostCSS based tools, including Autoprefixer.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user