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

How to add postcss plugins #14

Closed
PatrikLythell opened this issue Nov 21, 2016 · 6 comments
Closed

How to add postcss plugins #14

PatrikLythell opened this issue Nov 21, 2016 · 6 comments
Labels

Comments

@PatrikLythell
Copy link

PatrikLythell commented Nov 21, 2016

I ended up adding them to the postcss array in vue-loader.config.js because I couldn't get it to work.

Is there a better way or should we add a hook to the postcss array?

This feature request is available on Nuxt.js community (#c3)
@PatrikLythell PatrikLythell changed the title Add postcss plugins How to add postcss plugins Nov 21, 2016
@Atinux
Copy link
Member

Atinux commented Nov 21, 2016

Can you post your postcss config?

I may add build.postcss option in nuxt.config.js

@PatrikLythell
Copy link
Author

Just added postcss-cssnext to vue-loader.config.js inside my nuxt package for giggles. That made the build complain about double autoprefixer though (think it's included in cssnext).

Think build.postcss in nuxt.config.js would be sweet 👍

'use strict'

module.exports = function () {
  let config = {
    postcss: [
      require('postcss-cssnext')(),
      require('autoprefixer')({
        browsers: ['last 3 versions']
      })
    ],
…

@Atinux Atinux added the feature label Nov 21, 2016
@Atinux Atinux added this to the 1.0 milestone Nov 21, 2016
@Atinux
Copy link
Member

Atinux commented Nov 22, 2016

This option has been added in v0.6.7

Thank you @PatrikLythell for using Nuxt.js 😄

@Atinux Atinux closed this as completed Nov 22, 2016
@qur2
Copy link

qur2 commented Dec 12, 2016

Just for the record, since I spent few hours looking for that, here is the nuxt.config.js that worked for me:

module.exports = {
  build: {
    postcss: [
      require('postcss-nested')(),
      require('postcss-responsive-type')(),
      require('postcss-hexrgba')(),
    ]
  }
}

@tiagomatosweb
Copy link

That's cool, but seems that any scss file included by CSS array in the nuxt.config.js files is not prefixed.

css: [
      { src: '~assets/scss/app.scss', lang: 'scss' },
],

My workaround was import the scss file in the layout vue file, like so

<style lang="scss"> @import "~assets/scss/app.scss"; </style>

Any other better approach?

@lock
Copy link

lock bot commented Nov 5, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 5, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants