ThinkAlexandria / css-in-elm / Css.File

Functions for writing CSS files from elm-css.

compile : List Css.Stylesheet -> { css : String, warnings : List String }

Convenience re-export of Css.compile

compiler : (CssFileStructure -> Platform.Cmd.Cmd Basics.Never) -> CssFileStructure -> CssCompilerProgram

Create a program that compiles an elm-css stylesheet to a CSS file.

import Css.File exposing (CssCompilerProgram, CssFileStructure)
import HomepageCss as Homepage

port files : CssFileStructure -> Cmd msg

fileStructure : CssFileStructure
fileStructure =
    Css.File.toFileStructure
        [ ( "homepage.css", Css.File.compile [ Homepage.css ] ) ]

main : CssCompilerProgram
main =
    Css.File.compiler files fileStructure

toFileStructure : List ( String, { css : String, warnings : List String } ) -> CssFileStructure

Translate a list of filenames and prettyPrint results to a list of tuples suitable for being sent to a port in a Stylesheets.elm file.


type alias CssFileStructure =
List { filename : String
, content : String
, success : Basics.Bool 
}

A description of CSS files that will be created by elm-css.


type alias CssCompilerProgram =
Platform.Program {} () Basics.Never

A prorgam that compiles a CSS file.

See compiler.

Automatically-generated unique classes


type UniqueClass

Styles scoped under an automatically-generated class.

uniqueClass : List Css.Style -> UniqueClass

Create a style scoped under an automatically-generated class that is guaranteed to be unique - at least relative to other class names generated using this function!

Note: Use uniqueSvgClass for classes that will be used with SVG elements. These will not work with them!


type UniqueSvgClass

Styles scoped under an automatically-generated class. Use these for elements, as they use a different

uniqueSvgClass : List Css.Style -> UniqueSvgClass

Create a style scoped under an automatically-generated class that is guaranteed to be unique - at least relative to other class names generated using this function!

Note: Use uniqueClass for classes that will be used with SVG elements. These will only work with SVGs!