Transition *.css to compiler plugins

Note that we will need to execute our plan to bump the isopack/unibuild
formats and do careful backwards compatibility in order for published
packages containing these css sources to still be usable by existing
versions of Meteor.  (This also will include bumping compiler.BUILT_BY.)
This commit is contained in:
David Glasser
2015-05-15 14:12:54 -07:00
parent d2b151aea8
commit 74a697c332

View File

@@ -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()
});
});
};