This commit is contained in:
parent
bb88e63d58
commit
4c1adfc87a
|
@ -29,19 +29,11 @@ gulp.task('bundle-dist', () ->
|
|||
)
|
||||
|
||||
gulp.task('minify-dist', () ->
|
||||
return gulp.src(['./build/game/bundle.js'])
|
||||
return gulp.src(['./build/game/main.js'])
|
||||
.pipe(minify())
|
||||
.pipe(gulp.dest('./dist/game/'))
|
||||
)
|
||||
|
||||
bundle = () ->
|
||||
return gulp.src("./build/game/main.coffee")
|
||||
.pipe(coffee({
|
||||
bare: true
|
||||
sourcemaps: true
|
||||
}))
|
||||
.pipe(gulp.dest('./build/game'))
|
||||
|
||||
html = (target, debug) ->
|
||||
return () ->
|
||||
sources = [
|
||||
|
@ -107,18 +99,17 @@ gulp.task('procgen', (done) ->
|
|||
pattern = pattern.replace(/\..+$/, "")
|
||||
json[pattern] = snippet
|
||||
|
||||
mkdirp( "./build/game/procgen", (err) ->
|
||||
# we stringify JS object into coffeescript…
|
||||
code = cson.stringify({json}, {
|
||||
format: "coffeescript"
|
||||
indent: " "
|
||||
})
|
||||
# cut the first line and assign to a var
|
||||
code = "improvdata_#{language} =\n"+code.substring(code.indexOf("\n")+1)
|
||||
# write it as a file
|
||||
fs.writeFileSync "./build/game/procgen/#{language}.coffee", code
|
||||
#and then see concatCoffee task where we compile this
|
||||
)
|
||||
mkdirp.sync "./build/game/procgen"
|
||||
# we stringify JS object into coffeescript…
|
||||
code = cson.stringify({json}, {
|
||||
format: "coffeescript"
|
||||
indent: " "
|
||||
})
|
||||
# cut the first line and assign to a var
|
||||
code = "improvdata_#{language} =\n"+code.substring(code.indexOf("\n")+1)
|
||||
# write it as a file
|
||||
fs.writeFileSync "./build/game/procgen/#{language}.coffee", code
|
||||
#and then see concatCoffee task where we compile this
|
||||
return done()
|
||||
###
|
||||
return gulp.src([
|
||||
|
@ -128,7 +119,7 @@ gulp.task('procgen', (done) ->
|
|||
###
|
||||
)
|
||||
|
||||
gulp.task('concatCoffee', gulp.series('procgen', () ->
|
||||
gulp.task('concatCoffee', () ->
|
||||
gulp.src([
|
||||
# language
|
||||
'./game/translations/ru.coffee'
|
||||
|
@ -148,8 +139,16 @@ gulp.task('concatCoffee', gulp.series('procgen', () ->
|
|||
'./game/6_gamepadinit.coffee' # gamepad initialization
|
||||
]).pipe(concat('./main.coffee'))
|
||||
.pipe(gulp.dest('./build/game'))
|
||||
)
|
||||
|
||||
gulp.task('coffee', gulp.series('procgen', 'concatCoffee', () ->
|
||||
return gulp.src("./build/game/main.coffee")
|
||||
.pipe(coffee({
|
||||
bare: true
|
||||
sourcemaps: true
|
||||
}))
|
||||
.pipe(gulp.dest('./build/game'))
|
||||
))
|
||||
gulp.task('coffee', gulp.series('concatCoffee', bundle))
|
||||
|
||||
gulp.task('build', gulp.parallel(
|
||||
'html',
|
||||
|
@ -209,7 +208,7 @@ gulp.task('sass-dist', () ->
|
|||
|
||||
gulp.task('remove-big-bundle-dist', (done) ->
|
||||
return gulp.src([
|
||||
'./dist/game/bundle-min.js'
|
||||
'./dist/game/main-min.js'
|
||||
])
|
||||
.pipe(rm())
|
||||
.on('end', () -> done())
|
||||
|
@ -217,9 +216,9 @@ gulp.task('remove-big-bundle-dist', (done) ->
|
|||
|
||||
gulp.task('rename-min-bundle-dist', (done) ->
|
||||
return gulp.src([
|
||||
'./dist/game/bundle-min.js'
|
||||
'./dist/game/main-min.js'
|
||||
])
|
||||
.pipe(rename('bundle.js'))
|
||||
.pipe(rename('main.js'))
|
||||
.pipe(gulp.dest('./dist/game/'))
|
||||
.on('end', () -> done())
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue