How to use posthtml-render - 4 common examples

To help you get started, we’ve selected a few posthtml-render examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github parcel-bundler / parcel / packages / transformers / posthtml / src / PostHTMLTransformer.js View on Github external
generate({asset}) {
    return {
      code: render(nullthrows(asset.ast).program),
    };
  },
});
github posthtml / htmlnano / lib / modules / removeUnusedCss.es6 View on Github external
export default function removeUnusedCss(tree, options, uncssOptions) {
    let promises = [];
    const html = render(tree);
    tree.walk(node => {
        if (isStyleNode(node)) {
            promises.push(processStyleNode(html, node, uncssOptions));
        }
        return node;
    });

    return Promise.all(promises).then(() => tree);
}
github posthtml / htmlnano / lib / modules / minifySvg.es6 View on Github external
tree.match({tag: 'svg'}, node => {
        let svgStr = posthtmlRender(node);
        let promise = svgo.optimize(svgStr).then(result => {
            node.tag = false;
            node.attrs = {};
            node.content = result.data;
        });
        promises.push(promise);

        return node;
    });
github parcel-bundler / parcel / packages / transformers / html / src / HTMLTransformer.js View on Github external
generate({asset}) {
    return {
      code: render(nullthrows(asset.ast).program),
    };
  },
});

posthtml-render

Renders PostHTML Tree to HTML/XML

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular posthtml-render functions