CanopyTax / kremling

Embarrassingly simple css for React
https://kremling.js.org
Apache License 2.0
36 stars 4 forks source link

Make it work with preact #50

Open blittle opened 4 years ago

blittle commented 4 years ago

It would be great to make kremling work with preact

joeldenning commented 4 years ago

What part of kremling doesn't work, if you use preact-compat and alias react and react-dom inside of the webpack config?

blittle commented 4 years ago

Yeah, preact-compat works fine. I was hoping to not use the compatibility layer though.

joeldenning commented 4 years ago

What could kremling do differently to make it work with both? The library has to do import React from 'react' in order for jsx to work.

Potentially we could publish the src directory and remove all references to react from it - attempting to auto-inject the imports during build? Then you could use the published src directory and compile it with a different jsx pragma for preact?? I'm not sure if that would make sense - would gladly take direction from other projects that have done this.

geoctrl commented 4 years ago

I've actually been thinking about this lately - the core of kremling could be framework agnostic: on component mount, append css - on component unmount, remove css

seems like we could pull the core of kremling out and make framework-specific implementations (like how you guys did it with single-spa)

might be able to keep it all in the same package and force consumers to choose their framework:

import { Scoped } from 'kremling/react';

geoctrl commented 4 years ago

or make several packages: import { Scoped } from 'kremling-react'; import { Scoped } from 'kremling-preact';

blittle commented 4 years ago

This is a case where monorepos are useful :)

Maybe if I get time, I'll put together a mono repo implementation

geoctrl commented 4 years ago

started working on a mono repo, and thought it would be fun to implement kremling inside crankjs so I started there 😄

repo: https://github.com/geoctrl/kremling-monorepo

this is just an idea - I'm open to ideas - currently includes 3 packages:

adding preact should be pretty easy at this point - I can do that next when I get time

frehner commented 4 years ago

This is a case where monorepos are useful :)

don't hate me, but I agree with this. I feel like libraries are a good case for monorepos.