Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

css-modulesify does not play well with cssnext #44

Open
ryngonzalez opened this issue Sep 15, 2015 · 6 comments
Open

css-modulesify does not play well with cssnext #44

ryngonzalez opened this issue Sep 15, 2015 · 6 comments

Comments

@ryngonzalez
Copy link

I've tried with a bunch of configurations, and none seem to be working:

1. In --use declaration

  .plugin('css-modulesify', {
    rootDir: __dirname,
    output: `${dirs.dest.styles}/compiled.css`,
    use: [
      "postcss-modules-extract-imports",
      "postcss-modules-local-by-default",
      "postcss-modules-scope",
      'autoprefixer',
      'cssnext'
    ],
    'postcss-modules-scope': {
      generateScopedName: createClassName
    },
    after: [
    ]
  })

2. In --after declaration

  .plugin('css-modulesify', {
    rootDir: __dirname,
    output: `${dirs.dest.styles}/compiled.css`,
    use: [
      "postcss-modules-extract-imports",
      "postcss-modules-local-by-default",
      "postcss-modules-scope",
      'autoprefixer'
    ],
    'postcss-modules-scope': {
      generateScopedName: createClassName
    },
    after: [
      'cssnext'
    ]
  })

3. Required and used in --use declaration

  .plugin('css-modulesify', {
    rootDir: __dirname,
    output: `${dirs.dest.styles}/compiled.css`,
    use: [
      "postcss-modules-extract-imports",
      "postcss-modules-local-by-default",
      "postcss-modules-scope",
      'autoprefixer',
      require('cssnext')
    ],
    'postcss-modules-scope': {
      generateScopedName: createClassName
    },
    after: [
    ]
  })

4. Required and used in --after declaration

  .plugin('css-modulesify', {
    rootDir: __dirname,
    output: `${dirs.dest.styles}/compiled.css`,
    use: [
      "postcss-modules-extract-imports",
      "postcss-modules-local-by-default",
      "postcss-modules-scope",
      'autoprefixer'
    ],
    'postcss-modules-scope': {
      generateScopedName: createClassName
    },
    after: [
      require('cssnext')
    ]
  })

5. Required and used in --use declaration, initialized with options

  .plugin('css-modulesify', {
    rootDir: __dirname,
    output: `${dirs.dest.styles}/compiled.css`,
    use: [
      "postcss-modules-extract-imports",
      "postcss-modules-local-by-default",
      "postcss-modules-scope",
      'autoprefixer',
      require('cssnext')({})
    ],
    'postcss-modules-scope': {
      generateScopedName: createClassName
    },
    after: [
    ]
  })

6. Required and used in --after declaration, initialized with options

  .plugin('css-modulesify', {
    rootDir: __dirname,
    output: `${dirs.dest.styles}/compiled.css`,
    use: [
      "postcss-modules-extract-imports",
      "postcss-modules-local-by-default",
      "postcss-modules-scope",
      'autoprefixer'
    ],
    'postcss-modules-scope': {
      generateScopedName: createClassName
    },
    after: [
      require('cssnext')({})
    ]
  })

Am I just missing fundamental, or is there some for of issue with how we're adding additional PostCSS plugins to the css-modulesify pipeline?

@joshwnj
Copy link
Member

joshwnj commented Sep 19, 2015

HI @ryngonzalez do you have a repo somewhere that we can get a better look at what's going on?

@azevedo
Copy link

azevedo commented Oct 2, 2015

@ryngonzalez have you tried loading cssnext first, then autoprefixer, and finally the others?
cssnext includes the plugin postcss-import which recommends loading it as the first plugin in the list.

@izeau
Copy link

izeau commented Dec 25, 2015

Using postcss-cssnext instead of cssnext works wonders for me!

@ianstormtaylor
Copy link

@izeau where'd you put postcss-cssnext in your case? Can't see to get it working with --after. Also, is it working for globally defined CSS variables by any chance?

@jedrichards
Copy link

It's working alright for me in the cli:

browserify -t babelify -p [css-modulesify --after postcss-cssnext -o main.css] -o bundle.js src/index.js

@pixelass
Copy link

Here's a boilerplate that supports cssnext with this library. https://github.com/pixelass/npm-boilerplate

Here's a react/redux boilerplate with more config: https://github.com/pixelass/redux-react-boilerplate

Both work out of the box and need no config. I simply added it in the after array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants