0.1.0 • Published 4 years ago

@elodin/cli v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Warning: Elodin is still WIP and experimental. It is not recommended to use it in production yet. There might be unknown bugs and the APIs might change rapidly.

Elodin is a small styling language that aims to provide a universal way to author user interface styles.

  • Component-based:Elodin styles are authored on component-base and fully encapsulated from other styles accounting for predictable styling without side-effects. It also enables automatic code-splitting where each component is rendered to a new file.
  • Quick learning-curve:The syntax is a mix of CSS and JavaScript with some concepts from ReasonML and thus already familiar to many developers. It is declarative and unlike CSS only supports one value per property.
  • Write once, use everywhere:Elodin compiles to a variety of different languages, platforms and libraries without having to change a single line. It's truly one file for all targets!
  • Type-safe properties:The compiler will validate every property-value pair and throw on invalid rules resulting in solid code and bulletproof output. If it compiles, it works!

Example

Note: This example uses the generator-css-in-js with the fela adapter which is just one of many possible targets. Depending on the configuration the output will vary a lot.

variant Mode {
  Dark
  Light
}

view Header {
  height: $height
  justifyContent: center
  alignItems: flexEnd
  paddingBottom: 10
  paddingTop: 10

  [Mode=Dark] {
    backgroundColor: black
  }

  [Mode=Light] {
    backgroundColor: white
  }
}

text Label {
  fontSize: 15
  color: rgb(255 0 255)
}

This compiles to the following files where _hash is just a placeholder for an auto-generated unique class name.

Header.elo.css

._hash {
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 10;
  padding-top: 10;
}

._hash__0-0 {
  background-color: black;
}

._hash__0-1 {
  background-color: white;
}

Label.elo.css

._hash {
  font-size: 15px;
  color: rgb(255, 0, 255);
}

Header.elo.js

import './Header.elo.css'
import { getClassNameFromVariantMap } from '@elodin/runtime'

const variantClassNameMap = {
  '': {},
  '__0-0': {
    Mode: 'Dark',
  },
  '__0-1': {
    Mode: 'Light',
  },
}

export default function Header(props) {
  return {
    _className:
      '_elo_view _hash ' +
      getClassNameFromVariantMap(variantClassNameMap, props),
    height: props.height,
  }
}

Label.elo.js

import './Label.elo.css'

export default function Label() {
  return {
    _className: '_elo_text _hash',
  }
}

Documentation

Examples

Tooling

Contributing

Feel free to ask questions and give feedback on Spectrum. For more information follow the contribution guide. Also, please read our code of conduct.

License

Elodin is licensed under the MIT License. Documentation is licensed under Creative Common License. Created with ♥ by Robin Weser.

0.1.0

4 years ago

0.0.44

4 years ago

0.0.45

4 years ago

0.0.43

4 years ago

0.0.41

5 years ago

0.0.40

5 years ago

0.0.39

5 years ago

0.0.38

5 years ago

0.0.37

5 years ago

0.0.36

5 years ago

0.0.35

5 years ago

0.0.34

5 years ago

0.0.33

5 years ago

0.0.32

5 years ago

0.0.31

5 years ago

0.0.30

5 years ago

0.0.29

5 years ago

0.0.28

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago