Skip to content

Setting up CSS pipeline with addExtension and PostCSS plugins #2388

Answered by pepelsbey
pepelsbey asked this question in Q&A
Discussion options

You must be logged in to vote

I made it work with help of @monochromer 🥳

config.addExtension('css', {
  outputFileExtension: 'css',
  compile: async (inputContent, inputPath) => {
    if (inputPath !== './src/styles/index.css') {
      return;
    }

    return async () => {
      let output = await postcss([
        pimport,
        autoprefixer,
        csso
      ]).process(inputContent, { from: inputPath });

      return output.css;
    }
  }
});

It was a matter of proper function nesting. Now it also filters out all the paths apart from index.css, just like it supposed to.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@monochromer
Comment options

@pepelsbey
Comment options

@pepelsbey
Comment options

@monochromer
Comment options

@pepelsbey
Comment options

Answer selected by pepelsbey
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants