1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-22 09:54:24 +04:00
Files
tabler/build/scss-compile.js
2019-09-24 17:40:27 +02:00

49 lines
1.2 KiB
JavaScript

/*
* Tabler (v0.9.0): scss-compile.js
* Copyright 2018-2019 The Tabler Authors
* Copyright 2018-2019 codecalm
* Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE)
*/
//node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/tabler.scss dist/css/tabler.css
const path = require('path'),
glob = require("glob"),
fs = require("fs"),
sass = require("node-sass");
glob("scss/tabler*.scss", {}, function (er, files) {
files.forEach(function(file){
var basename = path.basename(file, '.scss');
sass.render(
{
file: file,
outFile: `dist/css/${basename}.css`,
sourceMap: true,
sourceMapContents: true,
precision: 6
},
(error, result) => {
if (!error) {
fs.writeFile(`dist/css/${basename}.css`, result.css, error => {
if (error) {
console.log(error);
}
});
fs.writeFile(`dist/css/${basename}.css.map`, result.map, error => {
if (error) {
console.log(error);
}
});
} else {
throw error;
}
}
);
});
});