Comments (5)
One big thing is that configuration should only need to be done for edge cases, not have to be done for every app. I don't think we should have config at all, I'd much rather have strict defaults like Aphrodite. If you want to use emojis, vendor it in and change those two lines of code – I'd rather we do that them have config.
I like the /native
entry point thing for ease-of-use and extendability.
from styled-components.
Oh no emojis are opt out 🔥😎🔥
On Mon., 3 Oct. 2016 at 5:10 pm Max Stoiber [email protected]
wrote:
One big thing is that configuration should only need to be done for edge
cases, not have to be done for every app. I don't think we should have
config at all, I'd much rather have strict defaults like Aphrodite. If you
want to use emojis, vendor it in and change those two lines of code – I'd
rather we do that them have config.I like the /native entry point thing for ease-of-use and extendability.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#39 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABa4MkDMJq32VzH-yMB9RN4X0RLf4V7ks5qwJxRgaJpZM4KMIk3
.
from styled-components.
More to the point, you were talking about supporting non-react things like glimmer/choo. Would they be separate repos or styled-components/framework
endpoints? I definitely agree that the default config should work for the majority of cases but it does sorta feel like the wider you want styled-components to be applicable the more use cases you're going to have to support.
Case in point, I think import { StyleSheet, css } from 'aphrodite/no-important'
is particularly bad. Maybe just because the default should not to use !important
everywhere but partially because you have to specify /no-important
every time you use the library. Surely there's a better way...
from styled-components.
Just recording my chat in the Gitter room. Neither of us like this:
// One time setup with default plugins and settings.
jss.setup(preset())
Because you have to do it every time. So we definitely want a zero config default.
Radium has a few different methods:
Aphrodite has a zero-config approach but exports another entry point for no-important
: https://github.com/Khan/aphrodite/blob/master/src/no-important.js
I still really dislike it because you have to specify it in every file, but I can't think of any other way to export a zero-config singleton by default and still allow customisation/experimentation. So, I think we should build SC so this is possible:
import Css from 'styled-components/lib/css'
import Styled from 'styled-components/lib/styled'
import Global from 'styled-components/lib/global'
import Keyframes from 'styled-components/lib/keyframes'
const css = new Css(...options)
const styled = new Styled(...options)
const global = new Global(...options)
const keyframes = new Keyframes(...options)
export { styled as default, css, global, keyframes }
This way people are effectively vendoring index.js
and providing different config to the underlying pieces. We have to change our implementation to support it of course but I think it's worth it. It separates the singleton-export from the underlying functionality neatly.
Folks are left having to do import styled from '../../styled-components.js'
or set up an alias or something but that's fine. It's the way JS is supposed to work anyway.
Also, we can now use this interface to provide React Native support:
/* styled-components/native.js */
import Css from './constructors/css'
import StyledNative from './constructors/styledNative'
const css = new Css({ nesting: false })
const styled = new StyledNative()
export { styled as default, css }
(assuming RN doesn't need global or keyframes). This is good. I like this.
from styled-components.
Ok yeah the use of new Css
in my examples doesn't quite work (since it's truly stateless and just a wrapper around the interpolation fragment) but I think I can get the others going.
from styled-components.
Related Issues (20)
- Fix plain NodeJS usage HOT 1
- RNW styles applied twice when using nextjs app directory with react-native-web with SSR HOT 1
- styled-components injects styles for non loaded components on react-native-web
- Simple Styled Component giving error about extending not existing component in Next 14
- Jest test fail on upgrading the styled-components lib version from 5.3.1 to 6.1.8
- correct work in nextjs app route with plugins
- TypeError: __vite_ssr_import_5__.default.div is not a function [fixed]
- `css` props are not applied within the server component.
- Failed to parse `&` multiple times in `:is() :where() :has()` pseudo-class selector
- Theme prop (not styled) is not being passed through HOT 1
- Feature request for v5 to ease migration to v6 of large ecosystems
- Interplay of `shouldForwardProp` clarifying question
- Export the `toStyleSheet` function HOT 3
- createGlobalStyle not working version >= 5.3.1 HOT 1
- [Docs] Lint for pseudo selectors - Styled Components update from v5 to v6 HOT 1
- Tailwind selectors do not work the expected (from me) way
- React SSR Streaming Bug
- Error while building project after upgrading from 5.3.11 to 6.0.0 HOT 2
- styled-components is ~50% larger than it could be due to IE11 support HOT 1
- Cannot infer the 'as' and 'forwardedAs' props by React.ComponentProps
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from styled-components.