Skip to content

yaitskov/css-parser

Repository files navigation

css-parser

This is a modern CSS parser and printer written in pure Haskell with Alex/Happy stack. CSS libraries test set includes: bootstrap, carbon, patternfly, uikit, primer, uswds, etc.

css-parser is based on css-selectors.

The work started to provide info about style sheets structure to miso-css.

Dev

$ nix develop
$ emacs src/CssParser.hs &
$ cabal test
$ cabal repl
ghci> import CssParser
ghci> parseCss "p {x: 1px;}"
CssFile {rules = [CssRule (Selector Nothing (TagSelector {tagNs = NoBar, tagName = TagName "p", tagSubSelectors = []}) [] :| []) [CssLeafRule (KnownDescriptor XT) (PropVals (IntVal (TypedNum "1" Px) :| []) Nothing)]]}
nix build
./result file.css
./result < file.css

Integration tests

cd itest
nix develop
intest

Links to successfully parsed CSS files are stored is .css-hashes folder to exclude them from consequent intest reruns.

About

Modern CSS parser in pure Haskell built on Alex+Happy stack

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors