giuseppeg / styled-jsx-postcss

Use PostCSS with styled-jsx 💥
MIT License
64 stars 11 forks source link

Export a non standalone version by default #10

Closed giuseppeg closed 7 years ago

giuseppeg commented 7 years ago

Right now styled-jsx-postcss inherits (extends) styled-jsx. In projects like Next.js this results in duplicate output and double work since they also include styled-jsx.

styled-jsx-postcss should export a plugin that doesn't inherits from styled-jsx.

For backwards compatibility we shouldn't change the current structure of the project. The non standalone version could be index.js.

Both standalone and not standalone vers will share the visitors but the latter will not extend styled-jsx.

timneutkens commented 7 years ago

Fixes https://github.com/zeit/next.js/issues/964

sarukuku commented 7 years ago

I'm eagerly waiting for this to get fixed as currently we can't update next at all as the project will not build because of this issue. 😄

sarukuku commented 7 years ago

Let me know if there's anything I can help with.

giuseppeg commented 7 years ago

I thought about this again and I think that probably it doesn't make sense to go down this path just because of Next.js

Even if I were to implement the idea from this issue we'd still need to monkey patch the Next.js preset to run styled-jsx-postcss right after styled-jsx and before optimizations. If we have to do so we might as well replace styled-jsx with styled-jsx-postcss cc @timneutkens @arunoda

giuseppeg commented 7 years ago

Fixed in zeit/next.js/pull/1147 cc @sarukuku ^

sarukuku commented 7 years ago

@giuseppeg excellent! I'll test it as soon as a release is pushed out on next.

sarukuku commented 7 years ago

Ah, it's just a config change. Will test later today.

corysimmons commented 7 years ago

Can we get an update on this please? I'd like to use styled-jsx-postcss with Next.js.

Posterity: https://github.com/giuseppeg/next.js/tree/220b20bdf344ea1028f5ddc16f55304207ea6a74/examples/with-styled-jsx-postcss#example-app-with-styled-jsx-postcss works but seems pretty hacky.

giuseppeg commented 7 years ago

@corysimmons that's good enough for now, soon probably we will add plugins support to styled-jsx which will allow us to add support for postcss, sass etc with just plugins

corysimmons commented 7 years ago

I like the idea of just adding PostCSS directly to styled-jsx. I mean, vanilla css will work w/ or w/o PostCSS plugins.

corysimmons commented 7 years ago

Nevermind, I misread this. Yeah, plugins sound good. 👍