martonlederer / esbuild-plugin-postcss2

Use postcss with esbuild
MIT License
33 stars 19 forks source link

Making it work with some postcss plugins #12

Open 8lall0 opened 3 years ago

8lall0 commented 3 years ago

Hello, here i am again.

I'm trying to run some postcss plugins without luck.

I'm parsing a sass file and then i use autoprefixer, and it works like a charm. Now i'm trying to minify the output, with cssnano.

const esbuild = require('esbuild');
const postCSSPlugin = require('esbuild-plugin-postcss2');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');

esbuild.build({
  entryPoints: ['index.js'],
  bundle: true,
  outfile: 'dist/bundle.js',
  plugins: [
    postCSSPlugin.default({
      plugins: [
        autoprefixer,
        cssnano,
      ],
    }),
  ],
}).catch((e) => console.error(e.message))

It doesn't give me any error, but it's not minifying anything.

Can you help me? thanks :)

martonlederer commented 3 years ago

Hey there, I have not used many plugins before, but maybe that would only work with the postcss compiler directly? I really don't know, if I have time later, I might try to reproduce this