bulma/test/dart-sass/dart-sass.js

51 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-11-23 17:44:02 +00:00
const fs = require("fs");
const path = require("path");
const sass = require("sass");
const utils = require("../utils");
2020-11-07 11:50:37 +00:00
2022-11-23 17:44:02 +00:00
const DART_BASE_PATH = "test/dart-sass/build/";
2020-11-07 11:50:37 +00:00
2020-11-07 17:19:18 +00:00
fs.mkdir(DART_BASE_PATH, { recursive: true }, (err) => {
if (err) throw err;
});
2020-11-07 11:50:37 +00:00
2020-11-07 17:19:18 +00:00
const exportDartCSS = (filepath, options) => {
2022-11-23 17:44:02 +00:00
utils.exportCSS(sass, fs, DART_BASE_PATH, filepath, options);
};
2020-11-07 11:50:37 +00:00
2020-11-07 17:19:18 +00:00
// Full import
2020-11-07 11:50:37 +00:00
2022-11-23 17:44:02 +00:00
exportDartCSS("bulma", {
file: "./bulma.scss",
2020-11-07 17:19:18 +00:00
});
2020-11-07 11:50:37 +00:00
2022-11-23 17:44:02 +00:00
exportDartCSS("bulma-rtl", {
file: "./bulma-rtl.scss",
2020-11-07 17:19:18 +00:00
});
2020-11-07 11:50:37 +00:00
// Custom import
fs.mkdir(`${DART_BASE_PATH}custom`, { recursive: true }, (err) => {
if (err) throw err;
});
2022-11-23 17:44:02 +00:00
utils.exportCSS(sass, fs, DART_BASE_PATH, "custom/navbar", {
data: '@use "./sass/components/navbar.scss" with ( $scheme-main: red );',
});
2020-11-07 17:19:18 +00:00
// Single imports
2020-11-07 11:50:37 +00:00
2020-11-07 17:19:18 +00:00
const BULMA_IMPORT_PATH = `./sass/`;
2020-11-07 11:50:37 +00:00
2020-11-07 17:19:18 +00:00
utils.SOURCES.forEach((source) => {
const parsed = path.parse(source);
2020-11-07 11:50:37 +00:00
2020-11-07 17:19:18 +00:00
fs.mkdir(`${DART_BASE_PATH}${parsed.dir}`, { recursive: true }, (err) => {
if (err) throw err;
2020-11-07 11:50:37 +00:00
});
2020-11-07 17:19:18 +00:00
exportDartCSS(`${parsed.dir}/${parsed.name}`, {
data: `@use "${BULMA_IMPORT_PATH}${source}";`,
});
2020-11-07 11:50:37 +00:00
});