Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vtex/tachyons-generator

Generate a custom Tachyons build from a json configuration
https://github.com/vtex/tachyons-generator

srv-store-framework xp-developer

Last synced: about 1 month ago
JSON representation

Generate a custom Tachyons build from a json configuration

Awesome Lists containing this project

README

        

# @vtex/tachyons-generator

Generate a custom VTEX Tachyons build with a json configuration.

Originally forked from [tachyons-generator](https://github.com/tachyons-css/generator).

## Installation

```bash
npm i -S @vtex/tachyons-generator
```

## Usage
This will generate an index.html file with the generated style guide as well as a static css file.

```javascript
const fs = require('fs')

const tachyonsGenerator = require('@vtex/tachyons-generator')
const config = require('./config.json')

const generate = async () => {
const tachy = tachyonsGenerator(config)

// Minify CSS
const out1 = await tachy.generate({ minify: true })
fs.writeFileSync('tachyons.min.css', out1)

// Keep colors as CSS variables
const out2 = await tachy.generate({ compileVars: false })
fs.writeFileSync('tachyons-with-vars.css', out2)

// Create stylesheet for devices of type "large" only
const out3 = await tachy.generate({ stylesheetType: 'large' })
fs.writeFileSync('tachyons-large.css', out3)

// Generate docs website
const docs = await tachy.docs()
fs.writeFileSync('index.html', docs)
}

generate()
```

#### Example config

Check [config.js](/config.js)

#### Optional configurations

#### `namespace`

You can pass a `namespace` property to namespace the CSS generated (including the normalize module).

Example:

```json
"namespace": "my-namespace",
```

Will generate the following CSS:

```css
.my-namespace .bg-black { background-color: #000; }
```

## License

MIT