Files
asciidisco.com/build/node_modules/css-tree/docs/translate.md
2023-08-01 13:49:46 +02:00

692 B

Translate AST to string

translate(ast)

Converts AST to string.

var ast = csstree.parse('.test { color: red }');
console.log(csstree.translate(ast));
// > .test{color:red}

translateWithSourceMap(ast)

The same as translate() but also generates source map (nodes should contain positions in loc property).

var ast = csstree.parse('.test { color: red }', {
    filename: 'my.css',
    positions: true
});
console.log(csstree.translateWithSourceMap(ast));
// { css: '.test{color:red}', map: SourceMapGenerator {} }