diff --git a/.gulp/tasks/icons.ts b/.gulp/tasks/icons.ts index ea7012d..da574b7 100644 --- a/.gulp/tasks/icons.ts +++ b/.gulp/tasks/icons.ts @@ -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 = {}; let pathTemp: string = './themes/.material-theme-icons.tmp'; + ensureDir(path.join(paths.THEMES)); + icons[icons.length - 1].last = true; partials.forEach(partial => { diff --git a/.gulp/tasks/themes.ts b/.gulp/tasks/themes.ts index 1e75ace..9dca1a8 100644 --- a/.gulp/tasks/themes.ts +++ b/.gulp/tasks/themes.ts @@ -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`); diff --git a/extensions/helpers/fs.ts b/extensions/helpers/fs.ts index 013f2ee..3e84ef6 100644 --- a/extensions/helpers/fs.ts +++ b/extensions/helpers/fs.ts @@ -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