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. (#13487)

- Add theme toggle to UI Framework header.
  • Loading branch information
cjcenizal authored Aug 14, 2017
1 parent 97812a1 commit b128db6
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 b128db6

Please sign in to comment.