-
Notifications
You must be signed in to change notification settings - Fork 75
Aphrodite vs. JSS - Thoughts? #172
Comments
Hi @kof! Here are my thoughts:
I hope that's helpful! Thanks for your work on JSS! |
Thank you for answers! A few thoughts from my side:
The approach itself is not bad as long as you need just one or two additional entry points, however this doesn't scale well. Regarding plugins: I think you are underestimating the amount of use cases, think for e.g. of postcss. Of course jss will not be able to handle this amount of plugins when used at runtime, but still, many interesting and experimental things happen because we have plugins, for e.g. jss-expand or jss-isolate Unpredictable rendering. The reason why Aphrodite needs to batching, is because it knows what CSS to render only at render time, when css() function is called. Batching is basically a workaround because adding rule by rule during render call would cause performance overhead, so they had no other way but batching. JSS doesn't need batching because it renders sheet upfront, once a component is going to mount. |
I think that the no-important.js thing and the plugins are related. If I were in favor of plugins then I would agree with you that Also, something I think is a very important part of libraries is to be able to look at code that's using a library and know what the result will be. If I were to put this: import jss from 'jss'
import jssExpand from 'jss-expand'
jss.use(jssExpand()) In a file like import jss from 'jss'
import jssExpand from 'jss-expand'
const instance = jss.getCustomInstance({plugins: [jssExpand()]})
export default instance And then using that module everywhere. I would definitely feel more comfortable about that. But still, you're suffering the cost of added complexity and a fragmented community. |
I totally agree, the order of plugins should not matter in the ideal world, but I couldn't find a way around. This issue is similar in express middleware. One way would be to provide presets, which will have all plugins installed by default. I am not sure if this should be the default or an optional thing. Creating separate jss instances is already in place. It is done by So when using a local Jss instance, you always know your setup for your application. Also it is possible to have different setups, for different parts of the application. |
I am slowly getting convinced, that the default, global instance should be with most official plugins installed. If one want a jss without plugins, create() will deliver a clean instance and one can setup all plugins. |
That'd be cool 👍 |
Another option would be to have a second entry file, which has plugins built in. To give a chance people who has a custom setup to not bundle default plugins at all. |
Yeah, give people the option and see what they do more frequently. |
Sorry for coming into your discussion, but why not to follow the Babel way? |
Thought about this option too, technically it is a nicer way, but would potentially also result in fragmenting community, those who installed the preset and those who installed plugins manually. Also this is +1 dependency and +1 function call. |
On the other hand, when creating a new instance, there should be also a way to define all plugins quickly ... probably we can't do it right without presets. |
presets released. |
@kof asked me:
The text was updated successfully, but these errors were encountered: