Gulpfile fixes

This commit is contained in:
Alexander Yakovlev 2017-07-22 12:49:54 +07:00
parent cf7c4ea91b
commit b009b3ee8b
4 changed files with 20 additions and 9 deletions

View File

@ -30,9 +30,18 @@ audio = (target) ->
return () -> return () ->
return gulp.src(['audio/*.mp3']).pipe(gulp.dest(target)) return gulp.src(['audio/*.mp3']).pipe(gulp.dest(target))
translations = (target) ->
if !fs.existsSync(target+'/translations')
fs.mkdirSync(target+'/translations')
for language in ['ru', 'en']
data = CSON.parseCSONFile('game/translations/'+language+'.cson')
json = JSON.stringify(data) + '\n'
fs.writeFileSync(target+"/translations/"+language+".json", json)
gulp.task('html', html('./build')) gulp.task('html', html('./build'))
gulp.task('img', img('./build/img')) gulp.task('img', img('./build/img'))
gulp.task('audio', audio('./build/audio')) gulp.task('audio', audio('./build/audio'))
gulp.task('translations', translations('./build/game'))
# SCSS styles # SCSS styles
gulp.task('sass', () -> gulp.task('sass', () ->
@ -42,13 +51,6 @@ gulp.task('sass', () ->
) )
gulp.task('concatCoffee', () -> gulp.task('concatCoffee', () ->
if !fs.existsSync('./build/game/translations')
fs.mkdirSync('./build/game/translations')
for language in ['ru', 'en']
data = CSON.parseCSONFile('game/translations/'+language+'.cson')
json = JSON.stringify(data) + '\n'
fs.writeFileSync("./build/game/translations/"+language+".json", json)
gulp.src([ gulp.src([
## additional functions ## additional functions
## the actual game ## the actual game
@ -64,7 +66,14 @@ gulp.task('coffee', ['concatCoffee'], () ->
.pipe(gulp.dest('./build/game/')) .pipe(gulp.dest('./build/game/'))
) )
gulp.task('build', ['html', 'img', 'sass', 'coffee', 'audio']) gulp.task('build', [
'html',
'img',
'sass',
'coffee',
'audio',
'translations'
])
gulp.task('serve', ['build'], () -> gulp.task('serve', ['build'], () ->
browserSync({ browserSync({
@ -97,6 +106,7 @@ gulp.task('legal-dist', () ->
return gulp.src(['LICENSE.txt']) return gulp.src(['LICENSE.txt'])
.pipe(gulp.dest("./dist")) .pipe(gulp.dest("./dist"))
) )
gulp.task('translations-dist', translations('./dist/game'))
gulp.task('sass-dist', () -> gulp.task('sass-dist', () ->
return gulp.src('./sass/main.scss') return gulp.src('./sass/main.scss')
@ -118,7 +128,8 @@ gulp.task('dist', [
'sass-dist', 'sass-dist',
'coffee-dist', 'coffee-dist',
'audio-dist', 'audio-dist',
'legal-dist' 'legal-dist',
'translations-dist'
]) ])
gulp.task('zip', ['dist'], () -> gulp.task('zip', ['dist'], () ->

0
build/game/.blankfile Normal file
View File

0
dist/game/.blankfile vendored Normal file
View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB