systemjs-plugin-css
Advanced tools
Comparing version
@@ -67,2 +67,3 @@ var CleanCSS = require('./clean-css.js'); | ||
}); | ||
cssLoads = []; | ||
@@ -73,3 +74,4 @@ return new Promise(function(resolve, reject) { | ||
target: outFile, | ||
root: loader.rootURL && path.resolve(loader.rootURL) | ||
root: loader.rootURL && path.resolve(loader.rootURL), | ||
relativeTo: fromFileURL(loader.baseURL) | ||
}).minify(inputFiles, function(err, minified) { | ||
@@ -98,4 +100,5 @@ if (err) | ||
else { | ||
// NB do data-encoding of css source map for non separateCSS case? | ||
// cssOutput += '/*# sourceMappingURL=data,'' | ||
if (outputOpts.sourceMaps) { | ||
cssOutput += '/*# sourceMappingURL=data:application/json;base64,' + new Buffer(result.map.toString()).toString('base64') + '*/'; | ||
} | ||
return cssInject + '\n("' + escape(cssOutput) + '");'; | ||
@@ -102,0 +105,0 @@ } |
@@ -9,6 +9,10 @@ /* | ||
this.translate = function(load, opts) { | ||
var loader = this; | ||
if (loader.builder && loader.buildCSS === false) { | ||
load.metadata.build = false; | ||
return; | ||
} | ||
var path = this._nodeRequire && this._nodeRequire('path'); | ||
var loader = this; | ||
return Promise.resolve(compileCSS.call(loader, load.source, load.address, load.metadata.loaderOptions || {})) | ||
@@ -67,2 +71,2 @@ .then(function(result) { | ||
module.exports = CSSPluginBase; | ||
module.exports = CSSPluginBase; |
@@ -112,3 +112,10 @@ if (typeof window !== 'undefined') { | ||
exports.cssPlugin = true; | ||
exports.fetch = function(load, fetch) { | ||
if (!this.builder) | ||
return ''; | ||
return fetch(load); | ||
}; | ||
exports.translate = function(load, opts) { | ||
if (!this.builder) | ||
return ''; | ||
var loader = this; | ||
@@ -120,2 +127,4 @@ return getBuilder(loader).then(function(builder) { | ||
exports.instantiate = function(load, opts) { | ||
if (!this.builder) | ||
return; | ||
var loader = this; | ||
@@ -122,0 +131,0 @@ return getBuilder(loader).then(function(builder) { |
{ | ||
"name": "systemjs-plugin-css", | ||
"version": "0.1.27", | ||
"version": "0.1.28", | ||
"main": "css", | ||
@@ -19,3 +19,6 @@ "registry": "jspm", | ||
"systemjs-builder": "^0.15.17" | ||
}, | ||
"scripts": { | ||
"phantom-test": "phantomjs test/phantom.js" | ||
} | ||
} |
@@ -27,3 +27,12 @@ var fs = require('fs') | ||
}); | ||
it('Should support buildCSS: false', function() { | ||
var builder = new Builder(); | ||
builder.config(System.getConfig()); | ||
builder.config({ buildCSS: false }); | ||
return builder.bundle('test/data/test.css!', {minify: false}).then(function(results) { | ||
return expect(results.source).to.equal(''); | ||
}); | ||
}) | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
374712
0.31%22
4.76%8696
0.37%4
33.33%