mirror of
https://github.com/Oreolek/shooter.git
synced 2024-04-26 05:59:19 +03:00
Gulp concatenation
This commit is contained in:
parent
e332f3e1d4
commit
32434811b9
29
Gulpfile.js
29
Gulpfile.js
|
@ -1,8 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
/* Raconteur Gulpfile scaffold. */
|
||||
/* Includes code adapted from Gulp documentation, among other sources. */
|
||||
|
||||
/* Imports */
|
||||
var watchify = require('watchify'),
|
||||
browserify = require('browserify'),
|
||||
|
@ -16,7 +13,8 @@ var watchify = require('watchify'),
|
|||
uglify = require('gulp-uglify'),
|
||||
buffer = require('vinyl-buffer'),
|
||||
zip = require('gulp-zip'),
|
||||
_ = require('lodash');
|
||||
_ = require('lodash'),
|
||||
concat = require('gulp-concat');
|
||||
|
||||
var reload = browserSync.reload;
|
||||
|
||||
|
@ -69,7 +67,7 @@ gulp.task('buildUndum', function () {
|
|||
/* Generate JavaScript with browser sync. */
|
||||
|
||||
var customOpts = {
|
||||
entries: ['./game/main.coffee'],
|
||||
entries: ['./build/game/main.coffee'],
|
||||
debug: true,
|
||||
transform: [coffeify]
|
||||
};
|
||||
|
@ -78,10 +76,6 @@ var opts = _.assign({}, watchify.args, customOpts);
|
|||
var bundler = watchify(browserify(opts));
|
||||
bundler.external('undum-commonjs');
|
||||
|
||||
gulp.task('coffee', ['buildUndum'], bundle); // `gulp coffee` will generate bundle
|
||||
bundler.on('update', bundle); // Re-bundle on dep updates
|
||||
bundler.on('log', gutil.log); // Output build logs to terminal
|
||||
|
||||
function bundle () {
|
||||
return bundler.bundle()
|
||||
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
|
||||
|
@ -89,6 +83,23 @@ function bundle () {
|
|||
.pipe(gulp.dest('./build/game'));
|
||||
};
|
||||
|
||||
gulp.task('copyTranslations', [], function() {
|
||||
gulp.src('./game/translations/*.coffee')
|
||||
.pipe(gulp.dest('./build/game/translations'));
|
||||
});
|
||||
|
||||
gulp.task('concatCoffee', ['copyTranslations'], function() {
|
||||
return gulp.src('./game/*.coffee')
|
||||
.pipe(concat('./main.coffee'))
|
||||
.pipe(gulp.dest('./build/game'));
|
||||
});
|
||||
|
||||
// `gulp coffee` will generate bundle
|
||||
gulp.task('coffee', ['buildUndum', 'concatCoffee'], bundle);
|
||||
|
||||
bundler.on('update', bundle); // Re-bundle on dep updates
|
||||
bundler.on('log', gutil.log); // Output build logs to terminal
|
||||
|
||||
/* Make a development build */
|
||||
|
||||
gulp.task('build', ['html', 'img', 'less', 'coffee', 'audio'], function () {
|
||||
|
|
19
game/00begin.coffee
Normal file
19
game/00begin.coffee
Normal file
|
@ -0,0 +1,19 @@
|
|||
# copyright (c) Alexander Yakovlev 2015.
|
||||
# This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0
|
||||
|
||||
situation = require('raconteur')
|
||||
undum = require('undum-commonjs')
|
||||
oneOf = require('raconteur/lib/oneOf.js')
|
||||
qualities = require('raconteur/lib/qualities.js')
|
||||
|
||||
undumloc = require("./translations/ru.coffee").language
|
||||
undum.language["ru"] = undumloc
|
||||
undumloc = require("./translations/en.coffee").language
|
||||
undum.language["en"] = undumloc
|
||||
$ = require("jquery")
|
||||
Array.prototype.oneOf = () ->
|
||||
oneOf.apply(null, this)
|
||||
|
||||
undum.game.id = "7a1aba32-f0fd-4e3b-ba5a-59e3fa9e6012"
|
||||
undum.game.version = "2.0"
|
|
@ -1,23 +1,3 @@
|
|||
# copyright (c) Alexander Yakovlev 2015.
|
||||
# This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0
|
||||
|
||||
situation = require('raconteur')
|
||||
undum = require('undum-commonjs')
|
||||
oneOf = require('raconteur/lib/oneOf.js')
|
||||
qualities = require('raconteur/lib/qualities.js')
|
||||
|
||||
undumloc = require("./ru.coffee").language
|
||||
undum.language["ru"] = undumloc
|
||||
undumloc = require("./en.coffee").language
|
||||
undum.language["en"] = undumloc
|
||||
$ = require("jquery")
|
||||
Array.prototype.oneOf = () ->
|
||||
oneOf.apply(null, this)
|
||||
|
||||
undum.game.id = "7a1aba32-f0fd-4e3b-ba5a-59e3fa9e6012"
|
||||
undum.game.version = "2.0"
|
||||
|
||||
qualities
|
||||
head:
|
||||
bullets: qualities.integer("bullets".l()),
|
||||
|
@ -46,7 +26,4 @@ undum.game.init = (character, system) ->
|
|||
# console.log( 'Character object:', character )
|
||||
#, 1000 );
|
||||
|
||||
require("./gameplay.coffee")
|
||||
require("./story.coffee")
|
||||
|
||||
window.onload = undum.begin
|
|
@ -20,6 +20,7 @@
|
|||
"gulp-uglify": "^1.2.0",
|
||||
"gulp-util": "^3.0.4",
|
||||
"gulp-zip": "^3.0.2",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"lodash": "^3.6.0",
|
||||
"vinyl-buffer": "^1.0.0",
|
||||
"vinyl-source-stream": "^1.1.0",
|
||||
|
|
Loading…
Reference in a new issue