Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[roadmap] sheetify v6 #105

Closed
3 tasks done
yoshuawuyts opened this issue Nov 8, 2016 · 12 comments
Closed
3 tasks done

[roadmap] sheetify v6 #105

yoshuawuyts opened this issue Nov 8, 2016 · 12 comments

Comments

@yoshuawuyts
Copy link
Contributor

yoshuawuyts commented Nov 8, 2016

Been using sheetify for a while now, and feel there's some rough edges still. In this issue I try and outline which problems I've been experiencing, and suggest solutions on how to fix 'em. Comments and suggestions super welcome; if we need to break stuff this is the place to mention it

problems

todos


And that's it. Suggestions and thoughts super welcome!

@ahdinosaur
Copy link
Member

hey @yoshuawuyts, sounds good to me. 👍

from my usage of sheetify, i really want to pass in style variables (as in say from require('./styles')) to each style declaration (#54, #97). unfortunately it's not easy unless we move to doing runtime inline styles instead of compiled string compilation, sooo yeah. 😄

@yoshuawuyts
Copy link
Contributor Author

@ahdinosaur yeah a simpler way would be to declare css variables in a :root element in some index file, and then import all other files. Order in sheetify is guaranteed so you could run a transform over the whole bundle which would then resolve the vars. Gets you vars across the board - not convinced we should do fancy interpolation stuffs / runtime parsing as that complicates stuff a bunch

@yoshuawuyts
Copy link
Contributor Author

e.g.

const css = require('sheetify')

css`
  :root {
    --main-bg-color: brown;
  }
`

/* can be in another file */
css`
  .foo {
    background-color: var(--main-bg-color);
  }
`

@Kriesse
Copy link

Kriesse commented Nov 11, 2016

@yoshuawuyts The above example looks good to me 👍

@ahdinosaur
Copy link
Member

@yoshuawuyts you're right that's way simpler, thanks for the suggestion. ✨

@yoshuawuyts yoshuawuyts changed the title [roadmap] sheetify v4 [roadmap] sheetify v6 Nov 16, 2016
@yoshuawuyts
Copy link
Contributor Author

Patches are done; can release sheetify@6 when these are merged:

yay!

@serapath
Copy link

serapath commented Nov 16, 2016

when using it like you suggest above, doesn't that encourage the use of a lot of global variables?

What if i have many components that were authored by different people, which used the same name for their variables, maybe even set those variables... how can i make sure my global css variable won't override or be overridden by a component that uses and sets it too?

@serapath
Copy link

serapath commented Nov 16, 2016

what about

const css = require('sheetify')

var x = css`
  :root {
    --main-bg-color: brown; /* will be auto-suffixed */
  }
`

/* can be in another file */
css`
  .foo {
    background-color: var(${x[':root/--main-bg-color']});
  }
`

then maybe somewhere in a root component that uses a lot of other components, maybe sheetify can offer the sum of all variables that have been defined in all the levels of nested components, so i can generate a style tag that sets all the values for all the variables... like maybe

var css = require('sheetify')
var yo = require('yo-yo')

Object.keys(css.vars()).forEach(x=>console.log(x)) // to see what is available for theming
// then later - remove the line above and replace it with something like:
css.vars()[':root/--main-bg-color'] = 'pink'

@yoshuawuyts
Copy link
Contributor Author

That wouldn't work as sheetify always returns a prefix. Having multiple
return types based on content feels off - besides Im not really seeing the
added value in the example. I understand globals are not ideal but then
again if variable name conflicts start to become an issue it might be time
to rethink what you're trying to do with CSS anyway haha.

On Wed, Nov 16, 2016, 17:35 Alexander Praetorius notifications@github.com
wrote:

what about

const css = require('sheetify')

var vars = css`

:root { --main-bg-color: brown; } /* can be in another file */ css .foo {

background-color: var(${vars[':root']});  }`


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#105 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACWlenYQgq2d-RMpHw3Yav5BKeSSRutgks5q-zDTgaJpZM4KsOHD
.

@yoshuawuyts
Copy link
Contributor Author

Released as v6.0.0 🎉

@serapath
Copy link

oh, didnt know sheetify is prefixing - guess that's fine too.

I try to build components which are white labeled pages made up of footer components and header components, made up of smaller components. If those components are written by different people or maybe by different me over time... i might not always remember what kind of css variables or names i used in all those different components, like: button, searchbar, signup form, image slider, menubar, and so on...

But once i pull all of them in to build a landing page component, how do i theme it?

I think that's were the basic idea from above comes from. Of course, how to express that in syntax is secondary to me.

I would appreciate some thoughts on how to deal with "complex" components made up of many sub components that i would like to theme and customize. I think i might not remember all the details, but something like css.vars() is a question from me to the component, so that it basically tells me all the stuff i can customize... ...maybe

@yoshuawuyts
Copy link
Contributor Author

yeah so you might be looking for something closer to styled-elements which
does all this during runtime - personally I don't think having theming
convenience is beneficial for components; being able to append classes and
later prune them is much more flexible I've found (e.g. the approach we're
taking with base-elements https://github.com/yoshuawuyts/base-elements) -
hope this somewhat answers your question!

On Sat, Nov 19, 2016 at 5:11 AM Alexander Praetorius <
notifications@github.com> wrote:

oh, didnt know sheetify is prefixing - guess that's fine too.

I try to build components which are white labeled pages made up of footer
components and header components, made up of smaller components. If those
components are written by different people or maybe by different me over
time... i might not always remember what kind of css variables or names i
used in all those different components, like: button, searchbar, signup
form, image slider, menubar, and so on...

But once i pull all of them in to build a landing page component, how do i
theme it?

I think that's were the basic idea from above comes from. Of course, how
to express that in syntax is secondary to me.

I would appreciate some thoughts on how to deal with "complex" components
made up of many sub components that i would like to theme and customize. I
think i might not remember all the details, but something like css.vars()
is a question from me to the component, so that it basically tells me all
the stuff i can customize... ...maybe


You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
#105 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACWlesdzvEiEn1odzPFBYhHVDZI9hr6cks5q_nbegaJpZM4KsOHD
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants