diff --git a/packages/meteor/plugin/basic-file-types.js b/packages/meteor/plugin/basic-file-types.js index 39d78e2b35..cc000ff862 100644 --- a/packages/meteor/plugin/basic-file-types.js +++ b/packages/meteor/plugin/basic-file-types.js @@ -2,9 +2,25 @@ we can't exactly define the *.js source file handler in a *.js source file. */ -Plugin.registerSourceHandler("css", {archMatching: 'web'}, function (compileStep) { - compileStep.addStylesheet({ - data: compileStep.read().toString('utf8'), - path: compileStep.inputPath - }); +// NOTE: It's only OK for *this* package to call this function directly, because +// otherwise we'd end up with a circular dependency between meteor and +// compiler-plugin. The issue we're trying to avoid by requiring an explicit +// dependency on compiler-plugin doesn't matter because css has some +// backwards-compatibility special-casing in the tool. +Plugin._doNotCallThisDirectly_registerCompiler({ + extensions: ['css'], + archMatching: 'web' +}, function () { + return new CssCompiler; }); + +var CssCompiler = function () { +}; +CssCompiler.prototype.processFilesForTarget = function (inputFiles) { + inputFiles.forEach(function (inputFile) { + inputFile.addStylesheet({ + data: inputFile.getContentsAsString(), + path: inputFile.getPathInPackage() + }); + }); +};