SassNinja / postcss-extract-media-query

PostCSS plugin to extract all media query from CSS and emit as separate files.
MIT License
130 stars 20 forks source link

Not creating css file for all other styles #44

Open jeffpreussner opened 3 months ago

jeffpreussner commented 3 months ago

I can only get the plugin to export files for the queries i enter, the css file with the queries removed no longer generates.

my config:

const path = require('path');

module.exports = {
  plugins: {
    "postcss-flexbugs-fixes":{},
    "postcss-preset-env":{  "stage": 3},
    'postcss-extract-media-query': {
      stats:true,
      entry:  path.join(__dirname, 'styles/global.css'),
      output: {
        path: path.join(__dirname, 'dist'), // emit to 'dist' folder in root
      },
      queries: {
        'print': "print",
        '(min-width:640px)': 'mobile',
        '(min-width:768px)': 'tablet',
        '(min-width:1280px)': 'desktop',
        '(min-width:1536px)': 'xl-desktop',
      },
      extractAll: false,
      config: path.join(__dirname, 'postcss.config.js')

    },
  },
};

generated files:

www/dist/global-desktop.css
www/dist/global-mobile.cs
www/dist/global-print.css
www/dist/global-tablet.css
www/dist/global-xl-desktop.css

notice there is not "global.css"

SassNinja commented 3 months ago

@jeffpreussner thanks for reaching out though I can't reproduce your issue

Using my postcss-cli example I always get an example.css even when setting entry & extractAll

How are you using postcss? Have you tried removing the other two postcss plugins incl. the config file?