-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
55 lines (46 loc) · 2.21 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const CleanCSS = require("clean-css");
const { table } = require("console");
const fs = require("fs");
const mustache = require("mustache");
// Specify the paths to your CSS files
const inputFiles = ["normalize.css", "sanitize.css", "style.css"];
// Read the content of the CSS files
const cssContent = inputFiles
.map((path) => fs.readFileSync(path, "utf8"))
.join("");
// Initialize a new instance of CleanCSS
const cleaner = new CleanCSS();
// Minify the combined CSS content
const output = cleaner.minify(cssContent);
// Specify the path for the output file
const outputPath = "dist/aluminium.min.css";
// Write the minified CSS to the output file
fs.writeFileSync(outputPath, output.styles);
const template = fs.readFileSync("index.template.html", "utf8");
const outputPage = mustache.render(template, {
input: fs.readFileSync("parts/input.html", "utf8"),
textarea: fs.readFileSync("parts/textarea.html", "utf8"),
radio: fs.readFileSync("parts/radio.html", "utf8"),
checkbox: fs.readFileSync("parts/checkbox.html", "utf8"),
table: fs.readFileSync("parts/table.html", "utf8"),
button: fs.readFileSync("parts/button.html", "utf8"),
select: fs.readFileSync("parts/select.html", "utf8"),
details: fs.readFileSync("parts/details.html", "utf8"),
blockquote: fs.readFileSync("parts/blockquote.html", "utf8"),
dialog: fs.readFileSync("parts/dialog.html", "utf8"),
nav: fs.readFileSync("parts/nav.html", "utf8"),
footer: fs.readFileSync("parts/footer.html", "utf8"),
grid: fs.readFileSync("parts/grid.html", "utf8"),
gridDefault: fs.readFileSync("parts/grid-default.html", "utf8"),
spacer: fs.readFileSync("parts/spacer.html", "utf8"),
row: fs.readFileSync("parts/row.html", "utf8"),
column: fs.readFileSync("parts/column.html", "utf8"),
centered: fs.readFileSync("parts/centered.html", "utf8"),
selective: fs.readFileSync("parts/selective.html", "utf8"),
container: fs.readFileSync("parts/container.html", "utf8"),
positioning: fs.readFileSync("parts/positioning.html", "utf8"),
customization: fs.readFileSync("parts/customization.html", "utf8"),
progress: fs.readFileSync("parts/progress.html", "utf8"),
spinner: fs.readFileSync("parts/spinner.html", "utf8"),
});
fs.writeFileSync("index.html", outputPage);