Move task of locales copying from webpack to gulp

This commit is contained in:
Aya Morisawa 2019-09-04 10:54:04 +09:00
parent aa19767ebc
commit dbe4b65f6d
No known key found for this signature in database
GPG key ID: 3E64865D70D579F2
2 changed files with 11 additions and 6 deletions

View file

@ -17,6 +17,7 @@ import * as rename from 'gulp-rename';
import * as mocha from 'gulp-mocha'; import * as mocha from 'gulp-mocha';
import * as replace from 'gulp-replace'; import * as replace from 'gulp-replace';
const uglifyes = require('uglify-es'); const uglifyes = require('uglify-es');
import * as fs from 'fs';
const locales = require('./locales'); 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.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([ gulp.src([
'./src/const.json', './src/const.json',
'./src/server/web/views/**/*', './src/server/web/views/**/*',

View file

@ -130,11 +130,6 @@ module.exports = {
}), }),
new WebpackOnBuildPlugin((stats: any) => { new WebpackOnBuildPlugin((stats: any) => {
fs.writeFileSync('./built/client/meta.json', JSON.stringify({ version: meta.version }), 'utf-8'); 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 VueLoaderPlugin(),
new webpack.optimize.ModuleConcatenationPlugin() new webpack.optimize.ModuleConcatenationPlugin()