From dbe4b65f6df88e7d874fcd7f764bea96b4734e66 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Wed, 4 Sep 2019 10:54:04 +0900 Subject: [PATCH] Move task of locales copying from webpack to gulp --- gulpfile.ts | 12 +++++++++++- webpack.config.ts | 5 ----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gulpfile.ts b/gulpfile.ts index 6ed597731..165e93063 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -17,6 +17,7 @@ import * as rename from 'gulp-rename'; import * as mocha from 'gulp-mocha'; import * as replace from 'gulp-replace'; const uglifyes = require('uglify-es'); +import * as fs from 'fs'; const locales = require('./locales'); @@ -51,7 +52,16 @@ gulp.task('build:copy:fonts', () => gulp.src('./node_modules/three/examples/fonts/**/*').pipe(gulp.dest('./built/client/assets/fonts/')) ); -gulp.task('build:copy', gulp.parallel('build:copy:views', 'build:copy:fonts', () => +gulp.task('build:copy:locales', cb => { + fs.mkdirSync('./built/client/assets/locales', { recursive: true }); + + for (const [lang, locale] of Object.entries(locales)) + fs.writeFileSync(`./built/client/assets/locales/${lang}.json`, JSON.stringify(locale), 'utf-8'); + + cb(); +}); + +gulp.task('build:copy', gulp.parallel('build:copy:views', 'build:copy:fonts', 'build:copy:locales', () => gulp.src([ './src/const.json', './src/server/web/views/**/*', diff --git a/webpack.config.ts b/webpack.config.ts index 24d2337a7..05714e97e 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -130,11 +130,6 @@ module.exports = { }), new WebpackOnBuildPlugin((stats: any) => { fs.writeFileSync('./built/client/meta.json', JSON.stringify({ version: meta.version }), 'utf-8'); - - fs.mkdirSync('./built/client/assets/locales', { recursive: true }); - - for (const [lang, locale] of Object.entries(locales)) - fs.writeFileSync(`./built/client/assets/locales/${lang}.json`, JSON.stringify(locale), 'utf-8'); }), new VueLoaderPlugin(), new webpack.optimize.ModuleConcatenationPlugin()