You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-11Lines changed: 8 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,21 +104,18 @@ main =
104
104
105
105
See [the `Css` module documentation](http://package.elm-lang.org/packages/rtfeldman/elm-css/latest/Css) for an explanation of how this code works.
106
106
107
-
`elm-css` draws inspiration from the excellent [Sass](http://sass-lang.com/), [Stylus](http://stylus-lang.com/), [CSS Modules](http://glenmaddern.com/articles/css-modules), and [styled-components](https://www.styled-components.com). It includes popular features like:
107
+
`elm-css` draws inspiration from the excellent [Sass](http://sass-lang.com/), [Stylus](http://stylus-lang.com/), [CSS Modules](http://glenmaddern.com/articles/css-modules), and [styled-components](https://www.styled-components.com) libraries. It includes features like:
-[nested media queries](https://davidwalsh.name/write-media-queries-sass) (and nested selectors in general, like how [Sass](http://sass-lang.com/) does them)
Copy file name to clipboardExpand all lines: src/Css.elm
+74-29Lines changed: 74 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -109,7 +109,7 @@ module Css
109
109
, any
110
110
, arabicIndic
111
111
, armenian
112
-
,asPairs
112
+
,asPairsDEPRECATED
113
113
, auto
114
114
, backgroundAttachment
115
115
, backgroundBlendMode
@@ -839,14 +839,14 @@ a [`Html.Styled`](Html-Styled) value which wraps a normal `Html` value and adds
839
839
styling information. Later, when you call [`toUnstyled`](Html-Styled#toUnstyled)
840
840
to convert this value to a normal `Html` value, it adds two elements to the DOM:
841
841
842
-
<button class="df8ab1">Reset<button>
842
+
<button class="_df8ab1">Reset<button>
843
843
844
844
<style>
845
-
.df8ab1 {
846
-
border-raidus: 10px;
845
+
._df8ab1 {
846
+
border-radius: 10px;
847
847
}
848
848
849
-
.df8ab1:hover {
849
+
._df8ab1:hover {
850
850
text-decoration: underline;
851
851
}
852
852
</style>
@@ -857,37 +857,69 @@ To sum up what's happening here:
857
857
2. That classname gets added to the element receiving the attiibute, and the style information gets stored in the `Html.Styled` value which wraps that element.
858
858
3. Calling `toUnstyled` converts this `Html.Styled` value to a normal `Html` value which represents both the requested element as well as a `<style>` element
859
859
860
-
This is how the elm-css `css` attribute is able to support things like
860
+
This is how the `css` attribute is able to support things like `hover` and media
861
+
queries.
861
862
863
+
`toUnstyled` avoids generating excess `<style>` elements and CSS declarations
864
+
by building up a dictionary of styles you've passed to `css`. It will use
865
+
that dictionary to add a single `<style>` to the DOM with the appropriate
866
+
classname declarations.
862
867
863
-
#### Missing CSS properties
864
868
865
-
`elm-css` is still in development. Not all CSS properties have been added yet.
866
-
If you run into this problem, `elm-css` includes the `property` function. It takes
867
-
two `Strings`; the property key, and its value.
869
+
#### Style Reuse
868
870
869
-
**e.g.**
871
+
The easiest way to reuse styles (like [mixins](http://sass-lang.com/guide#topic-6)
872
+
in other CSS systems) is through [`Style`](http://package.elm-lang.org/packages/rtfeldman/elm-css/latest/Css#Style)
873
+
values.
870
874
871
-
We want `z-index`, but suppose `elm-css` did not implement it. We would define it ourselves:
{ value =String.join ", "(List.map (\s -> s) list)}
8308
8351
8309
8352
8310
-
{-| Take a list of styles and return a list of key-value pairs that
8353
+
{-| DEPRECATED in favor of [`Html.Styled.Attributes.css`](Html-Styled-Attributes#css). This function will be removed in the next major release of elm-css.
8354
+
8355
+
Take a list of styles and return a list of key-value pairs that
0 commit comments