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

Usage with postcss autoprefixer? #69

Open
stfcodes opened this issue Jan 15, 2019 · 3 comments
Open

Usage with postcss autoprefixer? #69

stfcodes opened this issue Jan 15, 2019 · 3 comments
Labels
Bug Something isn't working

Comments

@stfcodes
Copy link

Hi @samselikoff 👋

I'm trying to use autoprefixer in my app following the example from ember-cli-postcss:

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const autoprefixer = require('autoprefixer');

module.exports = function (defaults) {
  const app = new EmberApp(defaults, {
    postcssOptions: {
      compile: {
        enabled: false
      },
      filter: {
        enabled: true,
        plugins: [
          {
            module: autoprefixer
          }
        ]
      }
    }
  });
  return app.toTree();
};

My simple use case is just to add the required prefixes for the .appearance-none class tailwind provides.

Unfortunately this results in a Build Error (broccoli-persistent-filter:PostcssFilter) in unrelated tailwind components I've added and I'm not sure how to continue.

Commenting out those components no longer yields the error, but an error is shown in the console: Refused to apply style from 'http://localhost:4200/assets/my-app.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Any ideas on what to do next?

Thanks in advance!

@fpauser
Copy link
Contributor

fpauser commented Jan 15, 2019

I also stumbled across this - however, enabling compilation and adding at least 1 postcss plugin fixed it:

const CssImport = require('postcss-import')
const CssNext = require('postcss-cssnext')

module.exports = {
  options: {
    postcssOptions: {
      compile: {
        enabled: true,
        plugins: [
          { module: CssImport },
          { module: CssNext }
        ]
      }
    }
  }
  ...
}

@samselikoff samselikoff added the Bug Something isn't working label Jan 15, 2019
@samselikoff
Copy link
Contributor

Hey there Stefan 😄

I'd have to dig into the error to understand what's happening, nothing obvious stands out to me.

In the meantime, you can definitely try working with the advanced usage, and use that function to get your css file built and into your treeForStyles, at which point you may then be able to re-run that built css through PostCSS? I would have to dive in to know for sure but don't have time atm...

If you (or anyone) wants to work on a PR to expose the PostCSS pipeline I can also direct.

@andrewfan
Copy link

@shuriu as a quick workaround you can use https://github.com/kimroen/ember-cli-autoprefixer or simply call https://github.com/sindresorhus/broccoli-autoprefixer yourself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants