12.0.3 • Published 4 years ago

@fela-next/fela-beautifier v12.0.3

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

fela-beautifier

The beautifier enhancer is a developer tool that automatically formats the rendered CSS markup on every change. It uses cssbeautify to achieve this.

Installation

yarn add fela-beautifier

You may alternatively use npm i --save fela-beautifier.

Usage

import { createRenderer } from '@fela-next/fela'
import beautifier from '@fela-next/fela-beautifier'

const renderer = createRenderer({
  enhancers: [ beautifier() ]
})

Configuration

Options

Uses the same options as cssbeautify does.

OptionValueDefaultDescription
ident(string) (2 spaces)a string used for the indentation of the declaration
openbraceend-of-line, separate-lineend-of-lineplacement of open curly brace
autosemicolon(boolean)falseinsert semicolon after the last rule
Example
import { createRenderer } from '@fela-next/fela'
import beautifier from '@fela-next/fela-beautifier'

const beautifyEnhancer = beautifier({
  openbrace: 'separate-line',
  autosemicolon: 'false',
  ident: '  ',
})

const renderer = createRenderer({
  enhancers: [ beautifyEnhancer ]
})

Example

Preview

License

Fela is licensed under the MIT License. Documentation is licensed under Creative Common License. Created with ♥ by @robinweser and all the great contributors.