Comparing version 0.1.2 to 0.1.3
13
index.js
@@ -1,9 +0,12 @@ | ||
var es = require('event-stream'); | ||
var csso = require('csso'); | ||
/* jshint node:true */ | ||
module.exports = function(){ | ||
'use strict'; | ||
'use strict'; | ||
var map = require('event-stream').map, | ||
csso = require('csso'); | ||
module.exports = function() { | ||
// Use csso(true) to turn structure minimization off. | ||
var optimise = (arguments.length > 0) ? arguments[0] : false; | ||
return es.map(function(file, cb) { | ||
return map(function(file, cb) { | ||
file.contents = new Buffer(csso.justDoIt(String(file.contents), optimise)); | ||
@@ -10,0 +13,0 @@ cb(null, file); |
{ | ||
"name": "gulp-csso", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Minify CSS with CSSO.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
51
test.js
@@ -0,22 +1,39 @@ | ||
/* jshint node: true */ | ||
/* global describe, it, before, beforeEach, after, afterEach */ | ||
'use strict'; | ||
var expect = require('chai').expect; | ||
var gutil = require('gulp-util'); | ||
var csso = require('./index'); | ||
it('should minify css with csso', function (cb) { | ||
var stream = csso(); | ||
var expect = require('chai').expect, | ||
gutil = require('gulp-util'), | ||
csso = require('./index'); | ||
stream.on('data', function(data) { | ||
expect(String(data.contents)).to.equal('h1{color:#ff0;font-size:2em}'); | ||
cb(); | ||
var basestyle = 'h1 { color: yellow; } \n h1 { font-size: 2em; }', | ||
optimalmin = 'h1{color:#ff0;font-size:2em}', | ||
nonoptimal = 'h1{color:#ff0}h1{font-size:2em}'; | ||
describe('gulp-csso', function() { | ||
it('should minify css with csso, performing structural optimisation', function (cb) { | ||
var stream = csso(); | ||
stream.on('data', function(data) { | ||
expect(String(data.contents)).to.equal(optimalmin); | ||
cb(); | ||
}); | ||
stream.write(new gutil.File({ | ||
contents: basestyle | ||
})); | ||
}); | ||
stream.write(new gutil.File({ | ||
contents: ' h1 { \ | ||
color: yellow \ | ||
} \ | ||
h1 { \ | ||
font-size: 2em \ | ||
}' | ||
})); | ||
it('should minify css with csso, with no structural optimisation', function (cb) { | ||
var stream = csso(true); | ||
stream.on('data', function(data) { | ||
expect(String(data.contents)).to.equal(nonoptimal); | ||
cb(); | ||
}); | ||
stream.write(new gutil.File({ | ||
contents: basestyle | ||
})); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4178
43