Module

PureStyle

Package
purescript-pure-style
Repository
oreshinya/purescript-pure-style

#StyleSheet Source

newtype StyleSheet

The type of stylesheet.

#createStyleSheet Source

createStyleSheet :: StyleSheet

Create a stylesheet.

#getStyle Source

getStyle :: StyleSheet -> String

Get all styles in a stylesheet.

#registerStyle Source

registerStyle :: StyleSheet -> String -> String

Define styles with css string.

This generate a hash from css string, and replace & with its hash in css string, finally return its hash string. So, returned string can be used as class name.

sheet :: StyleSheet
sheet = createStyleSheet

sampleClass :: String
sampleClass = registerStyle sheet
  """
  .& {
    width: 100px;
    height: 100px;
  }
  .&:hover {
    width: 100px;
    height: 100px;
  }
  .&:hover .selected {
    color: blue;
  }
  """

Added styles to stylesheet like:

.pz66dqm {
  width: 100px;
  height: 100px;
}
.pz66dqm:hover {
  width: 100px;
  height: 100px;
}
.pz66dqm:hover .selected {
  color: blue;
}
Modules
PureStyle