Comments (9)
DOWN WITH NAMING EVERYTHING THAT DOESNT DESERVE A NAME!!!!
βπΌοΈππ¨π½π©βπ©βπ§βπ¦ππ©
On Sun, Oct 16, 2016 at 6:54 AM Sunil Pai [email protected] wrote:
β
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#33 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAGHaPED2HWPmdtkH5CnQrTJIO8lavXIks5q0iyhgaJpZM4JuzTV
.
from glamor.
The next release will bring back the speedy flag. I'll bring a dev build for npmcdn too. Will close this once that's done. Thanks for the feedback, and do let me know if the issue pops up again.
from glamor.
Thanks for asking, I always have opinions π
So I really like the approach. I remember when I first heard about this library it was in Twitter code screenshots that had been retweeted a couple of times and I was intrigued, then when I actually wanted to learn more about the library, I couldn't find it π, luckily I dug through my Twitter feed and arrived here.
Recently I started building a React project with aphrodite
and I was running into some limitations. When I hovered over a button element I wanted to change the color of a child icon. Simple, right? In aphrodite
, not so much. It was still early in the project and partly inspired by @ryanflorence's recent video on actual inline styles I switched the code base to glamor to take advantage of the select
function. I was also using style-loader
/css-loader
, in the future I now want to replace them with insertRule
from glamor
. So the reasons I enjoy the switch are as follows:
- No class names. I think this is an undersold benefit of this approach, I'd definitely recommend throwing that benefit in the
README
. "Forget about naming styles!". Not having to give every div a name is awesome! And it takes so long to writeclassName
β¦ - Closeness to CSS. This one is definitely
glamor
specific. There's definitely a big move to try and make style interfaces common across all platforms. This approach intentionally shortcuts some of the power of CSS. I might be in the minority, but I still believe CSS has a very elegant design although I would never use it directly in a large app. So the escape hatches are critical. - The code just looks good. It really does π. Note I'm using the
{...style()}
syntax, I think the other styles just aren't as good. I've also barely looked at the tools outside ofindex.js
, so I haven't touchedreact.js
. - All the reasons @ryanflorence gave for liking inline styles, he was rightβ¦(although I think the
jsxstyle
approach leaves much to be desired. It's much harder to build in the CSS escape hatches, or to write semantic HTML).
I haven't been using it for long (about a week now) so I can't comment on any severe architectural limitations, but there are some gotchas I've found. Specificity issues with pseudo-classes is one. So :active
must always be more specific then :hover
and so they must be ordered appropriately in the style sheet. Also there was some wierdness with auto-prefixing when I tried writing something like: top: ['50%', 'calc(50% - 10px)']
(because I wanted a fallback for browsers that didn't support calc
. It's nothing an !important
won't fix though.
One thing a will note which probably should be warned about is animations. I haven't tested this, but I assume if you want 60fps you shouldn't be updating your style
object super frequently, correct? At that point I tend to fallback to the native style
attribute. As a side not I'm using @chenglou's react-motion
.
I also want to say, bravo on the implementation! It's really pretty neat how the software works. I saw you had a TODO item for static optimizations, it would be sweet to see a Babel transform or something π
Now it's your turn, why did you make this framework, what use cases of yours does it solve, what's your vision for its future?
from glamor.
This is greeeeeat feedback, thank you much!
- the :active / :hover issue; this is something glamor should be able to help with (and perhaps automatically fix?), opened #36 for the same
- can you give me a small input/expected/actual testcase for the fallback value problem? I want fallbacks to work in glamor, maybe I got my implementation wrong :|
- and yes, you don't want to use this for animations. I did some earlier work to see if it's possible, but came to the same conclusion as you; directly targeting
style
prop makes more sense/is faster/better. glamor for the rest!
I recommend you try out the /react
shim. specifically the css
prop via the createElement patch is a lot of fun/ saves typing.
- it accepts raw styles, so this is valid :
<div css={{ color: 'red' }}/>
- it accepts arrays, so this is valid
<div css={[ { color: 'red' }, hover({ color: 'blue' })]} />
So I've recently started building my own thing, and wasn't happy with 1-2 things with every library. aphrodite came closest, but the lack of escape hatches/ async behavior made it hard to use. really wanted a library with no compromises, so I went ahead and built it :) That's all really, no crazy grand vision.
It's pretty close to "feature complete", I plan on getting some enhancements in and then polishing it as time goes on. Happy to hear ideas :)
from glamor.
@calebmer @threepointone OMG I wish we were seeing more dialogs like this. You're both awesome β¨
ΰΌΌ γ€ β_β ΰΌ½γ€β¨β¨β¨
from glamor.
Thanks, very nice of you to say!
It shouldn't do the flash... do you have a sample to reproduce this?
from glamor.
I seem to have lost the speedy toggle in the refactor. I'll get that back in; it'll speed up rule insertion a lot and should make this less of an issue. Another ugly workaround is to compile with NODE_ENV=production
to trigger speedy.
Lemme know if you have a sample though, cheers.
from glamor.
Yep, I can confirm that when NODE_ENV=production
there is no flash π. Unfortunately though I donβt have enough time to put together a sample π. Especially since thereβs no development build I could import into a codepen.
Thanks though, it seems like you know whatβs going on π
Feel free to close this whenever youβre comfortable.
from glamor.
do you have any feedback you'd like to share? anything I could make better? what is your usecase? please and thanks :)
from glamor.
Related Issues (20)
- css.global doesn't support hover?
- Font Face Multiple Font Support HOT 1
- Promote css prop with react usage
- Deleting rules from the stylesheet
- Calling css({'data-css-nil': ''}) throws unexpected error HOT 1
- glamor-skeleton help
- psudeo element: scrollbar is not working
- Server-side rendering styles from a third-party library
- Values for the non-standard properties being set as numbers becomes as string with `px` concatenated in output HOT 4
- When NODE_ENV=production hydratation is broken
- Missing .d.ts for "glamor/server" HOT 1
- Outdated index.d.ts published HOT 1
- babel 7 support
- how to use -webkit-line-clamp HOT 1
- How to change src when the img hover ?
- Speedy mode is harmful for some production use cases (f.e. server-side rendering, prerendering, especially when glamor used in the library, etc)
- Generate inline style attribute text. HOT 3
- FBJS library causing vulnerability HOT 1
- className did not match
- update to a maintained `through`?
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 glamor.