Skip to content

Using postcss + autoprefixer alongside sass plugin #17

Description

@jcfranco

Maybe I'm missing something, but I don't notice any difference in output in a project that has both @stencil/sass and @stencil/postcss plugins.

Here's my config:

// stencil.config.ts

import { Config } from "@stencil/core";
import { postcss } from "@stencil/postcss";
import { sass } from "@stencil/sass";
import autoprefixer from "autoprefixer";

export const config: Config = {
  namespace: "repro",
  bundles: [
    {
      components: [
        // ...
      ]
    }
  ],
  outputTargets: [
    { type: "dist" },
    {
      type: "www",
      serviceWorker: null // disable service workers
    }
  ],
  globalStyle: "src/assets/styles/global.scss",
  plugins: [
    sass({
      injectGlobalPaths: ["src/assets/styles/global.scss"]
    }),

    (postcss as any)({
      plugins: [autoprefixer()]
    })
  ]
};

and my .browserslistrc looks like so:

# Browsers that we support
last 2 chrome versions
last 2 edge versions
last 2 ff versions
last 2 safari versions
last 2 ios versions
ie 11

I am not seeing any difference in the CSS that's inlined in the built components with and without PostCSS + Autoprefixer.

test class

  :host .test {
    display: grid;
    transition: all .5s;
    user-select: none;
    background: linear-gradient(to bottom, white, black);
  }

same output with and without PostCSS + Autoprefixer (formatted for readability)

  :host .test {
    display: grid;
    -webkit-transition: all .5s;
    transition: all .5s;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#000));
    background: linear-gradient(180deg, #fff, #000)
  }

If you use the test class in the Autoprefixer playground, and set the filter to last 2 chrome versions, last 2 edge versions, last 2 ff versions, last 2 safari versions, last 2 ios versions, ie 11, you get the following:

expected

  :host .test {
    display: -ms-grid;
    display: grid;
    transition: all .5s;
    -webkit-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;
            user-select: none;
    background: linear-gradient(to bottom, white, black);
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions