• Stars
    star
    317
  • Rank 132,216 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Generate a custom Tachyons build from a config file

tachyons-generator Build Status js-standard-style

This repo is currently under active development. It isn't currently ready for production, but we hope to have a beta out soon. Pull requests and issues welcome! If you'd like to lend a hand but don't know where to start please ping @johnotander ❀️.

Generate a custom Tachyons build with a json configuration. Inspiration from this tachyons issue.

Installation

npm i -S tachyons-generator

Or, use a curl request to generate css and docs

curl -X POST \
     -H "Content-Type: application/json" \
     -d '{"typeScale": [5,4,3,2,1,0.5] }' \
     https://tachyons.pub/api

or post the config.json file

curl -X POST \
     -H "Content-Type: application/json" \
     -d @config.json \
     https://tachyons.pub/api

Usage

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

const fs = require('fs')

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

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

  const out = await tachy.generate()

  fs.writeFileSync('index.html', out.docs)
  fs.writeFileSync('tachyons.css', out.css)
  fs.writeFileSync('tachyons.min.css', out.min)
}

generate()

Example config

{
  "typeScale": [
    3, 2.25, 1.5, 1.25, 1, 0.875
  ],
  "spacing": [.25, .5, 1, 2, 4, 8, 16],
  "lineHeight": [1, 1.25, 1.5],
  "customMedia": [
    { "m": 48 },
    { "l": 64 },
    { "xl": 128 }
  ],
  "colors": {
    "black": "#000",
    "near-black": "#111",
    "dark-gray": "#333",
    "mid-gray": "#555",
    "gray": "#777",
    "silver": "#999",
    "light-silver": "#aaa",
    "moon-gray": "#ccc",
    "light-gray": "#eee",
    "near-white": "#f4f4f4",
    "white": "#fff",
    "dark-red": "#f00008",
    "red": "#ff3223",
    "orange": "#f3a801",
    "gold": "#f2c800",
    "yellow": "#ffde37",
    "purple": "#7d5da9",
    "light-purple": "#8d4f92",
    "hot-pink": "#d62288",
    "dark-pink": "#c64774",
    "pink": "#f49cc8",
    "dark-green": "#006C71",
    "green": "#41D69F",
    "navy": "#001b44",
    "dark-blue": "#00449e",
    "blue": "#357edd",
    "light-blue": "#96ccff",
    "lightest-blue": "#cdecff",
    "washed-blue": "#f6fffe",
    "washed-green": "#e8fdf5",
    "washed-yellow": "#fff8d5",
    "light-pink": "#efa4b8",
    "light-yellow": "#f3dd70",
    "light-red": "#ffd3c0"
  },
  "nested": {
    "links": ["blue", "light-blue"]
  },
  "borderWidths": [0, 0.125, 0.25, 0.5, 1, 2],
  "borderRadius": [0, 0.125, 0.25, 0.5, 1],
  "widths": [1, 2, 4, 8, 16],
  "maxWidths": [1, 2, 4, 8, 16, 32, 48, 64, 96],
  "heights": [1, 2, 4, 8, 16],
  "tables": {
    "striped": ["light-silver", "moon-gray", "light-gray", "near-white"],
    "stripe": ["light", "dark"]
  },
  "typography":{
    "measure": [30, 34, 20]
  },
  "opacity": [1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0.05, 0.025, 0]
}

You can also omit the partials you don't need with the key skipModules, for example if you don't want normalize.css in the bundle you can do:

{
  "skipModules": ["normalize"]
}

Example npm commands

You can automate the generation and publishing using something like this pattern

  "start": "npm run build && npm run publish",
  "build": "node index.js",
  "publish": "curl -X POST -H 'Content-Type: application/json' -d @config.json  https://tachyons.pub/api"

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander (@4lpine).

More Repositories

1

tachyons

Functional css for humans
CSS
11,587
star
2

react-native-style-tachyons

Better styling for React Native
TypeScript
689
star
3

tachyons-sass

Transpiled Sass partials for Tachyons
SCSS
318
star
4

tachyons-custom

Tachyons with variables: for easy customization
CSS
203
star
5

tachyons-styled-react

Tachyons implemented with emotion and styled-system. Sits on create-react-app.
JavaScript
201
star
6

tachyons-tldr

quick lookup for tachyon classes, scales and colour palette
JavaScript
181
star
7

tachyons-and-react

[WIP] Documentation on using Tachyons and React together
JavaScript
119
star
8

tachyons-verbose

Functional CSS for humans. Verbose edition.
CSS
107
star
9

tachyons-webpack

A boilerplate for using tachyons with webpack
JavaScript
80
star
10

jekyll-tachyons

Jekyll + Tachyons Boilerplate
CSS
79
star
11

tachyons-css.github.io

Documentation for designing faster than the speed of light
HTML
77
star
12

cli

Cli to postprocess tachyons stylesheets and generate documentation
JavaScript
76
star
13

tachyons-box-sizing

Module moved to the Tachyons monorepo
CSS
40
star
14

tachyons-flexbox

Module moved to the Tachyons monorepo
CSS
40
star
15

tachyons-x-ray

Browser extension for tachyons-debug
JavaScript
29
star
16

tachyons-build-css

Transpile Tachyons postcss to vanilla css
JavaScript
27
star
17

tachyons-theme-ui

Theme UI implementation of Tachyons
JavaScript
25
star
18

tachyons-system

Tachyons theme for styled-system http://jxnblk.com/styled-system
JavaScript
24
star
19

tachyons-amp

Stripped down version of Tachyons for developing with Google AMP
CSS
18
star
20

tachyons-debug-grid

Module moved to the Tachyons monorepo
17
star
21

tachyons-typography

Module moved to the Tachyons monorepo
CSS
13
star
22

tachyons-spacing

Module moved to the Tachyons monorepo
CSS
13
star
23

tachyons-hovers

Module moved to the Tachyons monorepo
CSS
11
star
24

tachyons-colors

Module moved to the Tachyons monorepo
CSS
10
star
25

palette-generator

JavaScript
10
star
26

tachyons-forms

Module moved to the Tachyons monorepo
HTML
9
star
27

tachyons-queries

Custom media query variables for rework
JavaScript
9
star
28

tachyons-skins

Module moved to the Tachyons monorepo
CSS
9
star
29

tachyons-aspect-ratios

Module moved to the Tachyons monorepo
CSS
7
star
30

tachyons-modules

Get a list of all Tachyons CSS modules
JavaScript
7
star
31

tachyons-links

Module moved to the Tachyons monorepo
CSS
7
star
32

tachyons-display

Module moved to the Tachyons monorepo
CSS
7
star
33

tachyons-cms

CSS
7
star
34

tachyons-base

Module moved to the Tachyons monorepo
CSS
7
star
35

tachyons-z-index

Module moved to the Tachyons monorepo
CSS
6
star
36

tachyons-utilities

Module moved to the Tachyons monorepo
CSS
5
star
37

tachyons-negative-margins

Module moved to the Tachyons monorepo
CSS
5
star
38

tachyons-type-scale

Module moved to the Tachyons monorepo
CSS
5
star
39

tachyons-opacity

Module moved to the Tachyons monorepo
CSS
5
star
40

tachyons-docs

(WIP) React Documentation website for tachyons modules and components
JavaScript
4
star
41

tachyons-display-verbose

CSS
4
star
42

tachyons-widths

Module moved to the Tachyons monorepo
CSS
3
star
43

tachyons-skins-pseudo

Module moved to the Tachyons monorepo
CSS
3
star
44

tachyons-border-colors

Module moved to the Tachyons monorepo
CSS
3
star
45

tachyons-visibility

Module moved to the Tachyons monorepo
CSS
3
star
46

tachyons-debug

Module moved to the Tachyons monorepo
CSS
3
star
47

tachyons-borders

Module moved to the Tachyons monorepo
CSS
2
star
48

tachyons-tables

Module moved to the Tachyons monorepo
CSS
2
star
49

tachyons-background-size

Module moved to the Tachyons monorepo
CSS
2
star
50

tachyons-coordinates

Module moved to the Tachyons monorepo
CSS
2
star
51

tachyons-background-position

Module moved to the Tachyons monorepo
CSS
2
star
52

tachyons-text-align

Module moved to the Tachyons monorepo
CSS
2
star
53

tachyons-text-transform

Module moved to the Tachyons monorepo
CSS
2
star
54

tachyons-border-widths

Module moved to the Tachyons monorepo
CSS
2
star
55

tachyons-font-family

Module moved to the Tachyons monorepo
CSS
2
star
56

tachyons-box-shadow

Module moved to the Tachyons monorepo
CSS
2
star
57

tachyons-images

Module moved to the Tachyons monorepo
CSS
1
star
58

tachyons-heights

Module moved to the Tachyons monorepo
CSS
1
star
59

img

Images for the tachyons docs
1
star
60

tachyons-text-decoration

Module moved to the Tachyons monorepo
CSS
1
star
61

tachyons-outlines

Module moved to the Tachyons monorepo
CSS
1
star
62

tachyons-border-style

Module moved to the Tachyons monorepo
CSS
1
star
63

tachyons-border-radius

Module moved to the Tachyons monorepo
CSS
1
star
64

tachyons-floats

Module moved to the Tachyons monorepo
CSS
1
star
65

tachyons-rotations

Module moved to the Tachyons monorepo
CSS
1
star
66

tachyons-word-break

Module moved to the Tachyons monorepo
CSS
1
star
67

tachyons-line-height

Module moved to the Tachyons monorepo
CSS
1
star
68

tachyons-max-widths

Module moved to the Tachyons monorepo
CSS
1
star
69

tachyons-clears

Module moved to the Tachyons monorepo
CSS
1
star
70

tachyons-vertical-align

Module moved to the Tachyons monorepo
CSS
1
star
71

tachyons-styles

Empty partial for extending tachyons styles
SCSS
1
star