Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-csso

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-csso - npm Package Compare versions

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",

@@ -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
}));
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc