A Stylus CSS preprocessor parser for Elm that converts a strict subset of Stylus syntax to CSS.
elm install ad-si/elm-stylusimport Stylus.Parser exposing (stylusToCss)
stylus : String
stylus = """
div
width 400px
height 300px
background-color blue
h1, h2, h3
color red
font-size 18px
// This is a comment
.alert
color rgb(255, 0, 0)
"""
css : Result (List (DeadEnd Context Problem)) String
css = stylusToCss stylusThis will produce:
div{width:400px;height:300px;background-color:blue}
h1,h2,h3{color:red;font-size:18px}
/*This is a comment*/
.alert{color:rgb(255,0,0)}//The parser supports a strict subset of Stylus syntax:
selector
property value
another-property another-valueh1, h2, .important
font-weight bold
color blue// This is a comment
div
margin 0stylusToCss : String -> Result (List (DeadEnd Context Problem)) String
The main function that converts Stylus syntax to CSS. Returns a Result where:
Ok String contains the generated CSSErr (List (DeadEnd Context Problem)) contains parsing errorsTypes
Expression - AST node types (Rule, Comment, Newlines)Problem - Parsing error typesDevelopment
# Run tests
make test
# Install dependencies
npm install