gulp-bless
Advanced tools
Comparing version
var gulp = require('gulp'); | ||
var mocha = require('gulp-mocha'); | ||
var coverage = require('gulp-coverage'); | ||
var through2 = require('through2'); | ||
@@ -17,2 +16,7 @@ gulp.task('default', ['test']); | ||
})) | ||
/* | ||
// uncomment and comment out other coverage.* pipes to get coverage HTML report | ||
.pipe(coverage.report({ | ||
outFile: 'coverage.html' | ||
}))*/ | ||
.pipe(coverage.gather()) | ||
@@ -19,0 +23,0 @@ .pipe(coverage.enforce({ |
33
index.js
'use strict'; | ||
var through = require('through'); | ||
var os = require('os'); | ||
var through = require('through2'); | ||
var path = require('path'); | ||
@@ -16,8 +15,9 @@ var bless = require('bless'); | ||
function bufferContents(file, encoding, cb){ | ||
if (file.isNull()) return; // ignore | ||
if (file.isStream()) return this.emit('error', new PluginError(pluginName, 'Streaming not supported')); | ||
return through.obj(function(file, enc, cb) { | ||
if (file.isNull()) return cb(null, file); // ignore | ||
if (file.isStream()) return cb(new PluginError(pluginName, 'Streaming not supported')); | ||
var stream = this; | ||
if(file.contents){ | ||
if (file.contents && file.contents.toString()) { | ||
var fileName = path.basename(file.path); | ||
@@ -30,5 +30,5 @@ var outputFilePath = path.resolve(path.dirname(file.path), fileName); | ||
options: options | ||
}).parse(contents, function (err, blessedFiles, numSelectors) { | ||
}).parse(contents, function(err, blessedFiles, numSelectors) { | ||
if (err) { | ||
throw new PluginError(pluginName, err); | ||
return cb(new PluginError(pluginName, err)); | ||
} | ||
@@ -47,3 +47,3 @@ | ||
blessedFiles.forEach(function (blessedFile) { | ||
stream.emit('data', new File({ | ||
stream.push(new File({ | ||
cwd: file.cwd, | ||
@@ -55,14 +55,9 @@ base: file.base, | ||
}); | ||
cb(); | ||
}); | ||
} else { | ||
return cb(null, file); | ||
} | ||
else { | ||
cb(file, null); | ||
} | ||
} | ||
function endStream(){ | ||
this.emit('end'); | ||
} | ||
return through(bufferContents, endStream); | ||
}); | ||
}; |
{ | ||
"name": "gulp-bless", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "http://github.com/adam-lynch/gulp-bless", | ||
@@ -8,5 +8,5 @@ "description": "CSS post-processor which splits CSS files suitably for Internet Explorer < 10. Bless + Gulp = gulp-bless.", | ||
"dependencies": { | ||
"bless": "*", | ||
"bless": "~3.0.3", | ||
"gulp-util": "*", | ||
"through": "~2.3.4" | ||
"through2": "~0.5.1" | ||
}, | ||
@@ -17,4 +17,3 @@ "devDependencies": { | ||
"gulp-mocha": "*", | ||
"should": "*", | ||
"through2": "~0.4.1" | ||
"should": "*" | ||
}, | ||
@@ -21,0 +20,0 @@ "scripts": { |
gulp-bless [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url] | ||
========== | ||
CSS post-processor which splits CSS files suitably for Internet Explorer < 10. | ||
Gulp plugin which splits CSS files suitably for Internet Explorer < 10. | ||
@@ -61,2 +61,7 @@ This is the a [Gulp](http://github.com/gulpjs/gulp) wrapper around [bless.js](https://github.com/paulyoung/bless.js) (see [blesscss.com](http://blesscss.com/)). | ||
##### A note about sourcemaps: | ||
If you're using a CSS pre-processor which creates inline sourcemaps [bless.js](https://github.com/paulyoung/bless.js) will take a very long time to run. It's recommended that you don't pass files containing inline sourcemaps to `gulp-bless`. If you do want to use sourcemaps then create them as a separate `.map` file. | ||
If you can't create separate sourcemap files — such as if you are using ~v0.7 of [gulp-sass](https://www.npmjs.org/package/gulp-sass) which uses `libsass` — consider creating a minified version of your CSS (using something like [gulp-minify-css](https://www.npmjs.org/package/gulp-minify-css)) which strips out the inline sourcemap and running `gulp-bless` on that, then include that file in production whilst still including your development version with its inline sourcemap when developing locally. | ||
## Warning: gulp-bless has changed a lot since 1.0.0 | ||
@@ -75,2 +80,2 @@ - It no longer concatenates all files that come down the pipeline. | ||
[depstat-url]: https://david-dm.org/adam-lynch/gulp-bless | ||
[depstat-image]: https://david-dm.org/adam-lynch/gulp-bless.png | ||
[depstat-image]: https://david-dm.org/adam-lynch/gulp-bless.png |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
8090
15.57%4
-20%1
-50%80
8.11%72
-1.37%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated