bulma/test/node-sass/node-sass.js

45 lines
916 B
JavaScript
Raw Normal View History

2022-11-23 17:44:02 +00:00
const fs = require("fs");
const path = require("path");
const sass = require("node-sass");
const utils = require("../utils");
2020-11-07 17:19:18 +00:00
2022-11-23 17:44:02 +00:00
const NODE_SASS_BASE_PATH = "test/node-sass/build/";
2020-11-07 17:19:18 +00:00
fs.mkdir(NODE_SASS_BASE_PATH, { recursive: true }, (err) => {
if (err) throw err;
});
const exportNodeSassCSS = (filepath, options) => {
2022-11-23 17:44:02 +00:00
utils.exportCSS(sass, fs, NODE_SASS_BASE_PATH, filepath, options);
};
2020-11-07 17:19:18 +00:00
// Full import
2022-11-23 17:44:02 +00:00
exportNodeSassCSS("bulma", {
file: "./bulma.scss",
2020-11-07 17:19:18 +00:00
});
2022-11-23 17:44:02 +00:00
exportNodeSassCSS("bulma-rtl", {
file: "./bulma-rtl.scss",
2020-11-07 17:19:18 +00:00
});
// Single imports
const BULMA_IMPORT_PATH = `./sass/`;
utils.SOURCES.forEach((source) => {
const parsed = path.parse(source);
2022-11-23 17:44:02 +00:00
fs.mkdir(
`${NODE_SASS_BASE_PATH}${parsed.dir}`,
{ recursive: true },
(err) => {
if (err) throw err;
}
);
2020-11-07 17:19:18 +00:00
exportNodeSassCSS(`${parsed.dir}/${parsed.name}`, {
2020-11-07 17:40:05 +00:00
data: `@import "${BULMA_IMPORT_PATH}${source}";`,
2020-11-07 17:19:18 +00:00
});
});