Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions css-builder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var CleanCSS = require('clean-css');
var fs = require('fs');
var path = require('path');

function escape(source) {
return source
Expand All @@ -20,11 +21,14 @@ module.exports = function bundle(loads, opts) {
return "System\.register('" + load.name + "', [], false, function() {});";
}).join('\n');

var cssOutput = new CleanCSS().minify(loads.map(function(load) {
return load.source;
}).reduce(function(sourceA, sourceB) {
return sourceA + sourceB;
}, '')).styles;
var cssOutput = loads.map(function(load) {
return new CleanCSS({
target: this.separateCSS ? opts.outFile : '.',
relativeTo: path.dirname(load.address.substring('file:'.length)),
}).minify(load.source).styles;
}).reduce(function(s1, s2) {
return s1 + s2;
}, '');

// write a separate CSS file if necessary
if (this.separateCSS) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"registry": "jspm",
"dependencies": {
"clean-css": "npm:clean-css@~3.0.10",
"fs": "^0.1.1"
"fs": "^0.1.1",
"path": "^0.1.0"
}
}