Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 886 Bytes

generate.md

File metadata and controls

48 lines (32 loc) · 886 Bytes

Serialization AST to CSS

generate(ast[, options])

Generates a CSS string for given AST.

// generate with default settings
csstree.generate(ast);

// generate with options
csstree.generate(ast, {
    sourceMap: true
});

Options (optional):

sourceMap

Type: boolean
Default: false

Generates a source map (nodes should contain positions in loc property). Note, that an object instead of string is returned in that case.

const ast = csstree.parse('.test { color: red }', {
    filename: 'my.css',
    positions: true
});

const result = csstree.generate(ast, { sourceMap: true });
// { css: '.test{color:red}', map: SourceMapGenerator {} }

decorator

Type: function
Default: none

A function that returns handlers used by a generator. TBD