mirror of
https://github.com/jgthms/bulma.git
synced 2024-11-14 11:14:24 +00:00
41 lines
890 B
JavaScript
41 lines
890 B
JavaScript
|
const fs = require('fs');
|
||
|
const path = require('path');
|
||
|
const sass = require('node-sass');
|
||
|
const utils = require('./utils');
|
||
|
|
||
|
const NODE_SASS_BASE_PATH = 'test/build/node-sass/';
|
||
|
|
||
|
fs.mkdir(NODE_SASS_BASE_PATH, { recursive: true }, (err) => {
|
||
|
if (err) throw err;
|
||
|
});
|
||
|
|
||
|
const exportNodeSassCSS = (filepath, options) => {
|
||
|
utils.exportCSS(sass, fs, NODE_SASS_BASE_PATH, filepath, options)
|
||
|
}
|
||
|
|
||
|
// Full import
|
||
|
|
||
|
exportNodeSassCSS('bulma', {
|
||
|
file: './bulma.sass',
|
||
|
});
|
||
|
|
||
|
exportNodeSassCSS('bulma-rtl', {
|
||
|
file: './bulma-rtl.sass',
|
||
|
});
|
||
|
|
||
|
// Single imports
|
||
|
|
||
|
const BULMA_IMPORT_PATH = `./sass/`;
|
||
|
|
||
|
utils.SOURCES.forEach((source) => {
|
||
|
const parsed = path.parse(source);
|
||
|
|
||
|
fs.mkdir(`${NODE_SASS_BASE_PATH}${parsed.dir}`, { recursive: true }, (err) => {
|
||
|
if (err) throw err;
|
||
|
});
|
||
|
|
||
|
exportNodeSassCSS(`${parsed.dir}/${parsed.name}`, {
|
||
|
data: `@use "${BULMA_IMPORT_PATH}${source}";`,
|
||
|
});
|
||
|
});
|