Emotion: Disable Vendor Prefixing?

Created on 13 Oct 2017  路  6Comments  路  Source: emotion-js/emotion

  • emotion version: 8.0.5

https://github.com/emotion-js/emotion/blob/master/packages/emotion/src/index.js#L9

Does the current API provide a way to disable vendor prefixing? I noticed that stylis can take a prefix: false option, but I can't find any way to set it.

Enhancement

Most helpful comment

Actually creating own emotion instance is not that big deal if you are willing to add some webpack magic.

Just create your react-emotion instance to ./src/emotion.js and export it as the default export and add webpack resolve alias to it:

    resolve: {
        alias: {
            "react-emotion": path.resolve(
                __dirname,
                "src/emotion.js",
            ),
        },
    },

All 6 comments

This is a good idea. I've been wanting this for myself but I'm waiting on https://github.com/thysultan/stylis.js/issues/63#issuecomment-335955199 so that it can be set dynamically.

Thanks!

Now that prefixing can be set dynamically, what's the best way to expose this from emotion?

I just added a prefix option to instances that sets Stylis's prefix option

6138036dbc7e6df1f0e31175e24cff4ae548aeab

So so I have to manually create the instances with create-emotion and create-emotion-styled packages just to disable vendor prefixing?

I usually prefer disable them in development as it makes the style inspector needlessly noisy.

Actually creating own emotion instance is not that big deal if you are willing to add some webpack magic.

Just create your react-emotion instance to ./src/emotion.js and export it as the default export and add webpack resolve alias to it:

    resolve: {
        alias: {
            "react-emotion": path.resolve(
                __dirname,
                "src/emotion.js",
            ),
        },
    },
Was this page helpful?
0 / 5 - 0 ratings

Related issues

krzysztofzuraw picture krzysztofzuraw  路  78Comments

stolinski picture stolinski  路  37Comments

JustinTRoss picture JustinTRoss  路  26Comments

Slapbox picture Slapbox  路  24Comments

Metroninja picture Metroninja  路  24Comments