Published
Edited
Oct 9, 2022
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
cssProcessor = lightningcss({ minify }) // returns promise
Insert cell
Insert cell
Insert cell
Insert cell
lightningcss = async ({
browserTargets = defaultBrowserTargets,
minify = false
} = {}) => {
await lcss.init();

return (css) => {
let { code, map } = lcss.transform({
filename: "style.css",
targets: lcss.browserslistToTargets(browserTargets),
code: new TextEncoder().encode(css),
minify
});

return new TextDecoder().decode(code);
};
}
Insert cell
Insert cell
lcss = {
const lc = await import("https://unpkg.com/lightningcss-wasm@1.16.0?module");

return {
...lc,
init: lc.default
};
}
Insert cell
// Doesn't load in Safari
// browserslist = (await import("https://esm.sh/browserslist@4.21.4")).default
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more