Skip to content

Commit

Permalink
remove vinyl-sourcemaps-apply, #1 #7 #9
Browse files Browse the repository at this point in the history
  • Loading branch information
scniro committed Dec 8, 2016
1 parent 0b6914e commit a184c00
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 24 deletions.
18 changes: 0 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const applySourceMap = require('vinyl-sourcemaps-apply');
const CleanCSS = require('clean-css');
const objectAssign = require('object-assign');
const path = require('path');
Expand Down Expand Up @@ -27,30 +26,13 @@ module.exports = function gulpCleanCSS(options, callback) {
if (file.sourceMap)
fileOptions.sourceMap = JSON.parse(JSON.stringify(file.sourceMap));

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

//if (file.path) {
// cssFile = {};
// cssFile[file.path] = {styles: style};
//}

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

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

if (css.sourceMap) {

var 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, src);
});

applySourceMap(file, map);
}

if (typeof callback === 'function') {
var details = {
'stats': css.stats,
Expand Down
5 changes: 2 additions & 3 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": "2.1.3",
"version": "2.2.0",
"author": "scniro",
"license": "MIT",
"bugs": {
Expand Down Expand Up @@ -32,8 +32,7 @@
"clean-css": "^3.4.21",
"gulp-util": "^3.0.7",
"object-assign": "^4.1.0",
"through2": "^2.0.3",
"vinyl-sourcemaps-apply": "^0.2.1"
"through2": "^2.0.3"
},
"devDependencies": {
"chai": "^3.5.0",
Expand Down
3 changes: 1 addition & 2 deletions test/fixtures/sourcemaps/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<meta charset="UTF-8">
<title>gulp-clean-css: source maps</title>

<!--<link rel="stylesheet" href="sourcemapped.css"/>-->
<link rel="stylesheet" href="sourcemapped-relative.css"/>
<link rel="stylesheet" href="sourcemapped.css"/>
</head>
<body>
<p>source maps</p>
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/sourcemaps/sourcemapped.css
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
span{color:#1e90ff;font-size:16pt}div{padding:10px;margin:0 auto}
/*# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLyRzdGRpbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxLQUNJLE1BQU8sUUFDUCxVQUFXLEtBRWYsSUFDSSxRQUFTLEtBQ1QsT0FBUSxFQUFFIiwiZmlsZSI6InNvdXJjZW1hcHBlZC5jc3MiLCJzb3VyY2VzQ29udGVudCI6W251bGxdfQ== */

0 comments on commit a184c00

Please sign in to comment.