gdotdesign / elm-ui

UI library for making web applications with Elm
https://elm-ui.netlify.com
BSD 2-Clause "Simplified" License
920 stars 39 forks source link

Use elm-css #19

Closed pinx closed 7 years ago

pinx commented 8 years ago

https://github.com/rtfeldman/elm-css is nearly out of beta. Maybe an interesting candidate to integrate in elm-ui.

gdotdesign commented 8 years ago

Yes at some point I'll plan to migrate the CSS over to elm-css, there are some issues with generating CSS on the fly that needs to be weighed before committing to it though, also I want to wait until a stable release is ready (both elm-ui and elm-css).

I'll keep this issue open for discussion.

rtfeldman commented 8 years ago

@gdotdesign this is a cool project! I'm not sure what the issues are with generating CSS on the fly, but happy to help and talk through things! 😸

gdotdesign commented 8 years ago

@rtfeldman thanks for offering you help :smile:

So there are a couple of things that needs to be considered about this issue, I'll start with explaining how things currently are and what are the possible alternatives I see for it in elm-css:

In a different project we are generating CSS on the fly from a tree like component structure where components can inherit from each other so I have some experience from there, also using autoprefixer there as well:

So summing up the requirements:

Huh that ended up more than I though :sweat_smile:

bgourlie commented 7 years ago

I've taken an interest in getting this converted over to elm-css. I've started with implementing scale-color and have submitted a PR for it here.

gdotdesign commented 7 years ago

That's awesome! :)

I've started to migrate some of the CSS in the scoped-css branch: https://github.com/gdotdesign/elm-ui/compare/github-install...scoped-css the scoping and styledNode is as it turns out is a bad idea for multiple reasons, but the rest of the styles can be used as a starting point.

bgourlie commented 7 years ago

Sounds good! For any work I do on this, should I branch off the scoped-css branch and submit PR's to that branch?

gdotdesign commented 7 years ago

No, please create a branch from master, and start the styles in a separate directory somewhere.

Just ignore this module https://github.com/gdotdesign/elm-ui/blob/scoped-css/source/Ui/Styles/Html.elm because it's problematic to go this way.

So what I think we should do is just converting the styles to elm-css as is, meaning one style tag or one external file in the end.

gdotdesign commented 7 years ago

I've migrated all Sass stylesheets to Elm with the 1.0.0 release. I've opted for not using elm-css at this stage, but instead created a more Sass like version of it.

If any of you are interested in how it works check out these files: https://github.com/gdotdesign/elm-ui/blob/master/source/Css/Properties.elm https://github.com/gdotdesign/elm-ui/blob/master/source/Css.elm https://github.com/gdotdesign/elm-ui/blob/master/source/Ui/Styles/Theme.elm https://github.com/gdotdesign/elm-ui/blob/master/source/Ui/Styles.elm https://github.com/gdotdesign/elm-ui/blob/master/source/Native/Styles.js

And the styles are living here: https://github.com/gdotdesign/elm-ui/tree/master/source/Ui/Styles

It should not be hard to migrate them over to use elm-css provided it supports all of the features they need.

I'm closing this since it's been implemented (sort of).