forked from cibernox/ember-power-select
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-css.js
28 lines (24 loc) · 1.06 KB
/
compile-css.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var sass = require('node-sass'); // eslint-disable-line
var fs = require('fs');
var path = require('path');
var inputFile = path.join(__dirname, 'app', 'styles', 'ember-power-select.scss');
var outputFile = path.join(__dirname, 'vendor', 'ember-power-select.css');
var themesFolder = path.join(__dirname, 'app', 'styles', 'ember-power-select', 'themes');
var buf = fs.readFileSync(inputFile, "utf8");
// Compile main file
var result = sass.renderSync({
data: buf,
includePaths: ['app/styles', 'node_modules/ember-basic-dropdown/app/styles/']
});
fs.writeFileSync(outputFile, result.css);
// Compile themified versions
var themes = fs.readdirSync(themesFolder);
themes.forEach(function(theme) {
var parts = theme.split('.');
var out = sass.renderSync({
data: "@import 'app/styles/ember-power-select/themes/" + parts[0] + "';" + buf,
includePaths: ['app/styles', 'node_modules/ember-basic-dropdown/app/styles/']
});
var destinationFile = path.join(__dirname, 'vendor', 'ember-power-select-' + parts[0] + '.css');
fs.writeFileSync(destinationFile, out.css);
});