Skip to content

Commit 9ca15f2

Browse files
committed
attempt to fix rebasing, update deps
1 parent c272eac commit 9ca15f2

File tree

4 files changed

+190
-340
lines changed

4 files changed

+190
-340
lines changed

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gulp.task('pre-test', function () {
1111

1212
gulp.task('test', ['pre-test'], function () {
1313
return gulp.src('test/*.js')
14-
.pipe(mocha({reporter: 'list'}))
14+
.pipe(mocha({reporter: 'dot'}))
1515
.pipe(istanbul.writeReports({
1616
includeUntested: true,
1717
reporters: ['lcov']

index.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = function gulpCleanCSS(options, callback) {
1111
if (arguments.length === 1 && Object.prototype.toString.call(arguments[0]) === '[object Function]')
1212
callback = arguments[0];
1313

14-
var transform = function (file, enc, cb) {
14+
let transform = function (file, enc, cb) {
1515

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

27-
var style = file.contents ? file.contents.toString() : '';
27+
if (options.rebaseTo) {
28+
29+
let relative = path.resolve(file.path, options.rebaseTo);
30+
options.rebaseTo = path.relative(relative, file.path)
31+
}
32+
33+
let style = file.contents ? file.contents.toString() : '';
2834

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

3137
if (errors)
3238
return cb(errors.join(' '));
3339

3440
if (typeof callback === 'function') {
35-
var details = {
41+
let details = {
3642
'stats': css.stats,
3743
'errors': css.errors,
3844
'warnings': css.warnings,
3945
'path': file.path,
4046
'name': file.path.split(file.base)[1]
41-
}
47+
};
4248

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

5157
if (css.sourceMap) {
5258

53-
var map = JSON.parse(css.sourceMap);
59+
let map = JSON.parse(css.sourceMap);
5460
map.file = path.relative(file.base, file.path);
5561
map.sources = map.sources.map(function (src) {
5662
return path.relative(file.base, file.path)

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gulp-clean-css",
33
"description": "Minify css with clean-css.",
44
"homepage": "https://github.com/scniro/gulp-clean-css#readme",
5-
"version": "3.0.4",
5+
"version": "3.1.0",
66
"author": "scniro",
77
"license": "MIT",
88
"bugs": {
@@ -29,28 +29,28 @@
2929
"gulpfriendly"
3030
],
3131
"dependencies": {
32-
"clean-css": "^4.0.9",
33-
"gulp-util": "^3.0.8",
34-
"through2": "^2.0.3",
35-
"vinyl-sourcemaps-apply": "^0.2.1"
32+
"clean-css": "4.1.0",
33+
"gulp-util": "3.0.8",
34+
"through2": "2.0.3",
35+
"vinyl-sourcemaps-apply": "0.2.1"
3636
},
3737
"devDependencies": {
38-
"chai": "^3.5.0",
39-
"chai-string": "^1.3.0",
40-
"coveralls": "^2.12.0",
41-
"del": "^2.2.2",
42-
"express": "^4.15.2",
43-
"gulp": "^3.9.1",
44-
"gulp-concat": "^2.6.1",
45-
"gulp-istanbul": "^1.1.1",
46-
"gulp-mocha": "^4.0.1",
47-
"gulp-rename": "^1.2.2",
48-
"gulp-sass": "^3.1.0",
49-
"gulp-sourcemaps": "^2.4.1",
50-
"mocha": "^3.2.0",
51-
"vinyl": "^2.0.1",
52-
"vinyl-buffer": "^1.0.0",
53-
"vinyl-fs-fake": "^1.1.0"
38+
"chai": "3.5.0",
39+
"chai-string": "1.3.0",
40+
"coveralls": "2.13.1",
41+
"del": "2.2.2",
42+
"express": "4.15.2",
43+
"gulp": "3.9.1",
44+
"gulp-concat": "2.6.1",
45+
"gulp-istanbul": "1.1.1",
46+
"gulp-mocha": "4.3.1",
47+
"gulp-rename": "1.2.2",
48+
"gulp-sass": "3.1.0",
49+
"gulp-sourcemaps": "2.6.0",
50+
"mocha": "3.3.0",
51+
"vinyl": "2.0.2",
52+
"vinyl-buffer": "1.0.0",
53+
"vinyl-fs-fake": "1.1.0"
5454
},
5555
"scripts": {
5656
"test": "gulp test"

0 commit comments

Comments
 (0)