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

51 lines
1.1 KiB
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
// Custom import
fs.mkdir(`${DART_BASE_PATH}custom`, { recursive: true }, (err) => {
if (err) throw err;
});
utils.exportCSS(sass, fs, DART_BASE_PATH, 'custom/navbar', {
data: '@use "./sass/components/navbar.sass" 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
});