mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-19 03:49:34 +00:00
build: convert scripts from CJS to ESM
This commit is contained in:
parent
5433923733
commit
3dc6b6bb12
2 changed files with 34 additions and 33 deletions
|
@ -1,16 +1,15 @@
|
||||||
const fs = require("fs");
|
import fs from "fs";
|
||||||
const sass = require("sass");
|
import sass from "sass";
|
||||||
const autoprefixer = require("autoprefixer");
|
import autoprefixer from "autoprefixer";
|
||||||
const postcss = require("postcss");
|
import postcss from "postcss";
|
||||||
const path = require("path");
|
import path from "path";
|
||||||
|
|
||||||
(async () => {
|
const scss = fs
|
||||||
const scss = fs
|
|
||||||
.readdirSync("css")
|
.readdirSync("css")
|
||||||
.filter((file) => file.endsWith(".scss") && !/^\_popover/.test(file))
|
.filter((file) => file.endsWith(".scss") && !/^\_popover/.test(file))
|
||||||
.map((file) => path.parse(file));
|
.map((file) => path.parse(file));
|
||||||
|
|
||||||
for (const { name, base } of scss) {
|
for (const { name, base } of scss) {
|
||||||
const file = `css/${base}`;
|
const file = `css/${base}`;
|
||||||
const outFile = `css/${name}.css`;
|
const outFile = `css/${name}.css`;
|
||||||
|
|
||||||
|
@ -31,5 +30,4 @@ const path = require("path");
|
||||||
]).process(css, { from: undefined });
|
]).process(css, { from: undefined });
|
||||||
|
|
||||||
fs.writeFileSync(outFile, prefixed.css);
|
fs.writeFileSync(outFile, prefixed.css);
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
const fs = require("fs");
|
import fs from "fs";
|
||||||
const glob = require("glob");
|
import glob from "glob";
|
||||||
const { sveld } = require("sveld");
|
import { sveld } from "sveld";
|
||||||
const pkg = require("../package.json");
|
|
||||||
|
const pkg = JSON.parse(
|
||||||
|
fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
||||||
|
);
|
||||||
|
|
||||||
sveld({
|
sveld({
|
||||||
glob: true,
|
glob: true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue