From 67c7d3fe130e4632605c084c3e137c79634eed4d Mon Sep 17 00:00:00 2001 From: Josh Johnston Date: Thu, 3 Dec 2015 11:24:54 +1100 Subject: [PATCH] fixed a bug where postcss plugins were being added to the file system loader _before_ they were actually ready --- index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 7505996..35113b0 100644 --- a/index.js +++ b/index.js @@ -101,11 +101,6 @@ module.exports = function (browserify, options) { var jsonOutFilename = options.json || options.jsonOutput; var sourceKey = cssOutFilename; - var loader = loadersByFile[sourceKey]; - if (!loader) { - loader = loadersByFile[sourceKey] = new FileSystemLoader(rootDir, plugins); - } - // PostCSS plugins passed to FileSystemLoader var plugins = options.use || options.u; if (!plugins) { @@ -147,6 +142,12 @@ module.exports = function (browserify, options) { return plugin; }); + // get (or create) a loader for this entry file + var loader = loadersByFile[sourceKey]; + if (!loader) { + loader = loadersByFile[sourceKey] = new FileSystemLoader(rootDir, plugins); + } + // the compiled CSS stream needs to be avalible to the transform, // but re-created on each bundle call. var compiledCssStream;