Skip to content

Commit

Permalink
Update uiFramework build task and webpack config to support themed CS…
Browse files Browse the repository at this point in the history
…S files. (elastic#13487)

- Add theme toggle to UI Framework header.
  • Loading branch information
cjcenizal authored and snide committed Aug 14, 2017
1 parent b7768cd commit 4788330
Show file tree
Hide file tree
Showing 23 changed files with 2,574 additions and 71 deletions.
50 changes: 27 additions & 23 deletions tasks/ui_framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,34 @@ module.exports = function (grunt) {
}

function uiFrameworkCompile() {
const src = 'ui_framework/src/index.scss';
const dest = 'ui_framework/dist/ui_framework.css';

return new Promise(resolve => {
sass.render({
file: src,
}, function (error, result) {
if (error) {
grunt.log.error(error);
}

postcss([postcssConfig])
.process(result.css, { from: src, to: dest })
.then(result => {
grunt.file.write(dest, result.css);

if (result.map) {
grunt.file.write(`${dest}.map`, result.map);
}

resolve();
});
const compileTheme = name => {
const src = `ui_framework/src/${name}.scss`;
const dest = `ui_framework/dist/ui_framework_${name}.css`;

return new Promise(resolve => {
sass.render({
file: src,
}, function (error, result) {
if (error) {
grunt.log.error(error);
}

postcss([postcssConfig])
.process(result.css, { from: src, to: dest })
.then(result => {
grunt.file.write(dest, result.css);

if (result.map) {
grunt.file.write(`${dest}.map`, result.map);
}

resolve();
});
});
});
});
};

return Promise.all([compileTheme('theme_light'), compileTheme('theme_dark')]);
}

function uiFrameworkWatch() {
Expand Down
Loading

0 comments on commit 4788330

Please sign in to comment.