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

41 lines
850 B
JavaScript
Raw Normal View History

2020-11-07 17:19:18 +00:00
const fs = require('fs');
const path = require('path');
2020-11-07 11:50:37 +00:00
const sass = require('sass');
2020-11-07 17:27:34 +00:00
const utils = require('../utils');
2020-11-07 11:50:37 +00:00
2020-11-07 17:27:34 +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) => {
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
2020-11-07 17:19:18 +00:00
exportDartCSS('bulma', {
file: './bulma.sass',
});
2020-11-07 11:50:37 +00:00
2020-11-07 17:19:18 +00:00
exportDartCSS('bulma-rtl', {
file: './bulma-rtl.sass',
});
2020-11-07 11:50:37 +00:00
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
});