Skip to content

Separate styles for modern build #2791

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

Open
academici opened this issue Oct 23, 2018 · 3 comments
Open

Separate styles for modern build #2791

academici opened this issue Oct 23, 2018 · 3 comments

Comments

@academici
Copy link

What problem does this feature solve?

Reducing the size of the style files.
For browsers that support ES modules, using special autoprefixer rules ('Chrome >= 60', 'Safari >= 10.1', 'iOS >= 10.3', 'Firefox >= 54', 'Edge >= 15')

What does the proposed API look like?

unknown

@LinusBorg
Copy link
Member

That's hard to automate since (to my knowledge) <link> doesn't offer a nomodule attribute like <script> does, so we don't have a good way of letting the browser decide which style file to load.

@academici
Copy link
Author

@LinusBorg, here is my file postcss.config.js

const isModern = process.env.VUE_CLI_MODERN_MODE && !process.env.VUE_CLI_MODERN_BUILD
let autoprefixerConfig = {}

if(isModern) {
  autoprefixerConfig.browsers = [
    'Chrome >= 60',
    'Safari >= 10.1',
    'iOS >= 10.3',
    'Firefox >= 54',
    'Edge >= 15',
  ]
}

module.exports = {
  plugins: {
    autoprefixer: {
      lost: {},
      ...autoprefixerConfig,
    },
  },
};

Files are generated in the precache-manifest in dist folder
Maybe if "browsers" rule is not set, fill it in like this?

@LinusBorg
Copy link
Member

#3108 would add a note about this to the docs.

Don't think we can support this eleagantly during build.

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

No branches or pull requests

3 participants