bulma/test/dart-sass.js
2020-11-07 18:15:20 +00:00

41 lines
849 B
JavaScript

const fs = require('fs');
const path = require('path');
const sass = require('sass');
const utils = require('./utils');
const DART_BASE_PATH = 'test/build/dart-sass/';
fs.mkdir(DART_BASE_PATH, { recursive: true }, (err) => {
if (err) throw err;
});
const exportDartCSS = (filepath, options) => {
utils.exportCSS(sass, fs, DART_BASE_PATH, filepath, options)
}
// Full import
exportDartCSS('bulma', {
file: './bulma.sass',
});
exportDartCSS('bulma-rtl', {
file: './bulma-rtl.sass',
});
// Single imports
const BULMA_IMPORT_PATH = `./sass/`;
utils.SOURCES.forEach((source) => {
const parsed = path.parse(source);
fs.mkdir(`${DART_BASE_PATH}${parsed.dir}`, { recursive: true }, (err) => {
if (err) throw err;
});
exportDartCSS(`${parsed.dir}/${parsed.name}`, {
data: `@use "${BULMA_IMPORT_PATH}${source}";`,
});
});