forked from cibernox/ember-power-select
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile-css.js
47 lines (43 loc) · 1.12 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var sass = require('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);
});