chore: Creates automatically the theme directory while building

This commit is contained in:
octod 2017-11-01 12:54:09 +01:00
parent 5764a674fd
commit 704b6231f5
3 changed files with 16 additions and 0 deletions

View file

@ -10,6 +10,7 @@ import { CHARSET } from "../../extensions/consts/files";
import { IGenericObject } from "../../extensions/interfaces/igeneric-object";
import { IIcon } from './../interfaces/iicon';
import paths from '../../extensions/consts/paths';
import { ensureDir } from '../../extensions/helpers/fs';
/**
* Returns an object implementing the IIcon interface
@ -49,6 +50,8 @@ export default gulp.task('build:icons', cb => {
let partialsData: IGenericObject<any> = {};
let pathTemp: string = './themes/.material-theme-icons.tmp';
ensureDir(path.join(paths.THEMES));
icons[icons.length - 1].last = true;
partials.forEach(partial => {

View file

@ -10,6 +10,7 @@ import { CHARSET } from "../../extensions/consts/files";
import { IDefaults } from "../../extensions/interfaces/idefaults";
import { IThemeVariant } from './../interfaces/itheme-variant';
import paths from '../../extensions/consts/paths';
import { ensureDir } from '../../extensions/helpers/fs';
let commons: IDefaults = require('../../extensions/defaults.json');
@ -37,6 +38,8 @@ fileNames.forEach(fileName => {
export default gulp.task('build:themes', cb => {
gulpUtil.log(gulpUtil.colors.gray(HR));
ensureDir(path.join(paths.THEMES));
try {
themeVariants.forEach(variant => {
let filePath = path.join(paths.THEMES, `./${variant.name}.json`);

View file

@ -8,6 +8,16 @@ import { IDefaults } from "../interfaces/idefaults";
import { IThemeIcons } from "../interfaces/itheme-icons";
import { PATHS } from "../consts/paths";
/**
* @export
* @param {string} dirname
*/
export function ensureDir(dirname: string): void {
if (!fs.existsSync(dirname)) {
fs.mkdirSync(dirname);
}
}
/**
* Gets default value
* @export