Skip to content

Commit

Permalink
attempt to fix rebasing, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
scniro committed May 7, 2017
1 parent c272eac commit 9ca15f2
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 340 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ gulp.task('pre-test', function () {

gulp.task('test', ['pre-test'], function () {
return gulp.src('test/*.js')
.pipe(mocha({reporter: 'list'}))
.pipe(mocha({reporter: 'dot'}))
.pipe(istanbul.writeReports({
includeUntested: true,
reporters: ['lcov']
Expand Down
16 changes: 11 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function gulpCleanCSS(options, callback) {
if (arguments.length === 1 && Object.prototype.toString.call(arguments[0]) === '[object Function]')
callback = arguments[0];

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

if (!file || !file.contents)
return cb(null, file);
Expand All @@ -24,21 +24,27 @@ module.exports = function gulpCleanCSS(options, callback) {
if (file.sourceMap)
options.sourceMap = JSON.parse(JSON.stringify(file.sourceMap));

var style = file.contents ? file.contents.toString() : '';
if (options.rebaseTo) {

let relative = path.resolve(file.path, options.rebaseTo);
options.rebaseTo = path.relative(relative, file.path)
}

let style = file.contents ? file.contents.toString() : '';

new CleanCSS(options).minify(style, function (errors, css) {

if (errors)
return cb(errors.join(' '));

if (typeof callback === 'function') {
var details = {
let details = {
'stats': css.stats,
'errors': css.errors,
'warnings': css.warnings,
'path': file.path,
'name': file.path.split(file.base)[1]
}
};

if (css.sourceMap)
details['sourceMap'] = css.sourceMap;
Expand All @@ -50,7 +56,7 @@ module.exports = function gulpCleanCSS(options, callback) {

if (css.sourceMap) {

var map = JSON.parse(css.sourceMap);
let map = JSON.parse(css.sourceMap);
map.file = path.relative(file.base, file.path);
map.sources = map.sources.map(function (src) {
return path.relative(file.base, file.path)
Expand Down
42 changes: 21 additions & 21 deletions 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": "3.0.4",
"version": "3.1.0",
"author": "scniro",
"license": "MIT",
"bugs": {
Expand All @@ -29,28 +29,28 @@
"gulpfriendly"
],
"dependencies": {
"clean-css": "^4.0.9",
"gulp-util": "^3.0.8",
"through2": "^2.0.3",
"vinyl-sourcemaps-apply": "^0.2.1"
"clean-css": "4.1.0",
"gulp-util": "3.0.8",
"through2": "2.0.3",
"vinyl-sourcemaps-apply": "0.2.1"
},
"devDependencies": {
"chai": "^3.5.0",
"chai-string": "^1.3.0",
"coveralls": "^2.12.0",
"del": "^2.2.2",
"express": "^4.15.2",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",
"gulp-istanbul": "^1.1.1",
"gulp-mocha": "^4.0.1",
"gulp-rename": "^1.2.2",
"gulp-sass": "^3.1.0",
"gulp-sourcemaps": "^2.4.1",
"mocha": "^3.2.0",
"vinyl": "^2.0.1",
"vinyl-buffer": "^1.0.0",
"vinyl-fs-fake": "^1.1.0"
"chai": "3.5.0",
"chai-string": "1.3.0",
"coveralls": "2.13.1",
"del": "2.2.2",
"express": "4.15.2",
"gulp": "3.9.1",
"gulp-concat": "2.6.1",
"gulp-istanbul": "1.1.1",
"gulp-mocha": "4.3.1",
"gulp-rename": "1.2.2",
"gulp-sass": "3.1.0",
"gulp-sourcemaps": "2.6.0",
"mocha": "3.3.0",
"vinyl": "2.0.2",
"vinyl-buffer": "1.0.0",
"vinyl-fs-fake": "1.1.0"
},
"scripts": {
"test": "gulp test"
Expand Down

0 comments on commit 9ca15f2

Please sign in to comment.