Skip to content

Commit

Permalink
#18
Browse files Browse the repository at this point in the history
  • Loading branch information
scniro committed Dec 9, 2016
1 parent d23d5ac commit 73ee63b
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
sandbox
node_modules
coverage
test/fixtures/sourcemaps/sourcemapped.css
test/fixtures/sourcemaps/sourcemapped-relative.css
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.2.1 (12/09/2016)

- bug fix #18 => https://github.com/scniro/gulp-clean-css/issues/18#issuecomment-266127536

# 2.2.0 (12/08/2016)

- remove vinyl-sourcemaps-apply in favor of clean-css sourcemap engine
Expand Down
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ module.exports = function gulpCleanCSS(options, callback) {

var transform = function (file, enc, cb) {

if (!file || !file.contents)
return cb(null, file);

if (file.isStream()) {
this.emit('error', new PluginError('gulp-clean-css', 'Streaming not supported!'));
return cb();
return cb(null, file);
}

var fileOptions = objectAssign({target: file.path}, options);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "gulp-clean-css",
"description": "Minify css with clean-css.",
"homepage": "https://github.com/scniro/gulp-clean-css#readme",
"version": "2.2.0",
"version": "2.2.1",
"author": "scniro",
"license": "MIT",
"bugs": {
Expand Down
Empty file added test/fixtures/empty.css
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion test/fixtures/sourcemaps/sourcemapped.css

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('gulp-clean-css: base functionality', function () {
it('should play nicely with other plugins: gulp-sass: before', function (done) {
var i = 0;

gulp.src('test/fixtures/**/*.scss')
gulp.src(['test/fixtures/**/*.scss', '!test/fixtures/empty/**'])
.pipe(gulpSass())
.pipe(cleanCSS())
.pipe(gulp.dest('test/fixtures/'))
Expand All @@ -52,6 +52,24 @@ describe('gulp-clean-css: base functionality', function () {
});
});

it('should allow the file through:empty file, pipe dest', function (done) {
var i = 0;

gulp.src('test/fixtures/empty/**/*.scss')
.pipe(gulpSass())
.pipe(cleanCSS())
.pipe(gulp.dest(function (file) {
return `${file.base}/empty-parsed`;
}))
.on('data', function (file) {
i += 1;
})
.once('end', function () {
i.should.equal(3);
done();
});
});

it('should produce the expected file', function (done) {
var mockFile = new File({
cwd: '/',
Expand Down

0 comments on commit 73ee63b

Please sign in to comment.