Skip to content
This repository has been archived by the owner on Dec 2, 2018. It is now read-only.

Commit

Permalink
Tidy up, bump dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-eb committed Jul 2, 2015
1 parent 1f69f4f commit 1a12006
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015 Ben Briggs
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
*If you have any difficulties with the output of this plugin, please use the
[UnCSS tracker][bugs].*

Install via [npm](https://npmjs.org/package/gulp-uncss):
## Install

With [npm](https://npmjs.org/package/gulp-uncss) do:

```
npm install gulp-uncss --save-dev
Expand Down Expand Up @@ -94,7 +96,7 @@ to cover it.

## License

MIT © Ben Briggs
MIT © [Ben Briggs](http://beneb.info)

[bugs]: https://github.com/giakki/uncss/issues
[ci]: https://travis-ci.org/ben-eb/gulp-uncss
Expand Down
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ var uncss = require('uncss'),

PLUGIN_NAME = 'gulp-uncss';

module.exports = function(options) {
var stream = new transform({ objectMode: true });
module.exports = function (options) {
var stream = new transform({objectMode: true});

// Ignore stylesheets in the HTML files; only use those from the stream
options.ignoreSheets = [/\s*/];

stream._transform = function(file, unused, done) {
stream._transform = function (file, encoding, cb) {
if (file.isStream()) {
var error = 'Streaming not supported';
return done(new gutil.PluginError(PLUGIN_NAME, error));
return cb(new gutil.PluginError(PLUGIN_NAME, error));
} else if (file.isBuffer()) {
options = assign(options, { raw: String(file.contents) });
uncss(options.html, options, function(err, output) {
options = assign(options, {raw: String(file.contents)});
uncss(options.html, options, function (err, output) {
if (err) {
return done(new gutil.PluginError(PLUGIN_NAME, err));
return cb(new gutil.PluginError(PLUGIN_NAME, err));
}
file.contents = new Buffer(output);
done(null, file);
cb(null, file);
});
} else {
// Pass through when null
done(null, file);
cb(null, file);
}
};

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
"gulpplugin"
],
"dependencies": {
"gulp-util": "~3.0.1",
"object-assign": "^2.0.0",
"uncss": "^0.12.0"
"gulp-util": "~3.0.6",
"object-assign": "^3.0.0",
"uncss": "^0.12.1"
},
"devDependencies": {
"chai": "~1.10.0",
"event-stream": "~3.2.1",
"gulp": "~3.8.10",
"gulp-jshint": "~1.9.0",
"jshint-stylish": "~1.0.0",
"mocha": "~2.1.0",
"chai": "~3.0.0",
"event-stream": "~3.3.1",
"gulp": "~3.9.0",
"gulp-jshint": "~1.11.2",
"jshint-stylish": "~2.0.1",
"mocha": "~2.2.5",
"mocha-silent-reporter": "^1.0.0"
},
"main": "index.js"
Expand Down

0 comments on commit 1a12006

Please sign in to comment.