1
0
Fork 0
mirror of https://github.com/Oreolek/raconteur-scaffold.git synced 2024-04-25 21:49:22 +03:00

Remove exportUndum() hack

This commit is contained in:
Bruno Dias 2015-04-30 11:00:11 -03:00
parent 7d3d5c2c27
commit 7d991e2fa5
5 changed files with 32 additions and 6 deletions

3
CHANGES.md Normal file
View file

@ -0,0 +1,3 @@
# 2015-04-30
- Removed exportUndum() from scaffold. That functionality has been deprecated in Raconteur itself, and making sure there is only one Undum object is now the responsibility of the build system. The Gulpfile in this scaffold now corrects for this, so problem solved.

View file

@ -49,6 +49,15 @@ gulp.task('less', function () {
.pipe(gulp.dest('./build/css')); .pipe(gulp.dest('./build/css'));
}); });
/* Bundle libraries */
var undumBundler = browserify({debug: true});
undumBundler.require('undum-commonjs');
gulp.task('buildUndum', function () {
return undumBundler.bundle().pipe(source('undum.js')).pipe(gulp.dest('./build/game'));
});
/* Generate JavaScript with browser sync. */ /* Generate JavaScript with browser sync. */
var customOpts = { var customOpts = {
@ -59,8 +68,9 @@ var customOpts = {
var opts = _.assign({}, watchify.args, customOpts); var opts = _.assign({}, watchify.args, customOpts);
var bundler = watchify(browserify(opts)); var bundler = watchify(browserify(opts));
bundler.external('undum-commonjs');
gulp.task('coffee', bundle); // `gulp coffee` will generate bundle gulp.task('coffee', ['buildUndum'], bundle); // `gulp coffee` will generate bundle
bundler.on('update', bundle); // Re-bundle on dep updates bundler.on('update', bundle); // Re-bundle on dep updates
bundler.on('log', gutil.log); // Output build logs to terminal bundler.on('log', gutil.log); // Output build logs to terminal
@ -102,6 +112,16 @@ gulp.task('serve', ['build'], function () {
/* Distribution tasks */ /* Distribution tasks */
var undumDistBundler = browserify();
undumDistBundler.require('undum-commonjs');
gulp.task('undum-dist', function () {
return undumDistBundler.bundle().pipe(source('undum.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest('./dist/game'));
});
gulp.task('html-dist', html('./dist')); gulp.task('html-dist', html('./dist'));
gulp.task('img-dist', img('./dist/img')); gulp.task('img-dist', img('./dist/img'));
@ -118,11 +138,13 @@ var distBundler = browserify({
transform: ['coffeeify'] transform: ['coffeeify']
}); });
gulp.task('coffee-dist', function () { distBundler.external('undum-commonjs');
gulp.task('coffee-dist', ['undum-dist'], function () {
return distBundler.bundle() return distBundler.bundle()
.pipe(source('bundle.js')) .pipe(source('bundle.js'))
.pipe(buffer()) //.pipe(buffer())
.pipe(uglify()) //.pipe(uglify())
.on('error', gutil.log) .on('error', gutil.log)
.pipe(gulp.dest('./dist/game')); .pipe(gulp.dest('./dist/game'));
}); });

View file

@ -11,7 +11,7 @@ so this copyright notice may be removed and replaced with your own.
# Require the libraries we rely on # Require the libraries we rely on
situation = require('raconteur') situation = require('raconteur')
situation.exportUndum() # Ensures our Undum object is the same as Raconteur's undum = require('undum-commonjs')
$ = require('jquery') $ = require('jquery')
oneOf = require('raconteur/lib/oneOf.js') oneOf = require('raconteur/lib/oneOf.js')
elements = require('raconteur/lib/elements.js') elements = require('raconteur/lib/elements.js')

View file

@ -9,6 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/main.css">
<script type="text/javascript" src="game/undum.js"></script>
<script type="text/javascript" src="game/bundle.js"></script> <script type="text/javascript" src="game/bundle.js"></script>
</head> </head>
<body> <body>

View file

@ -1,7 +1,7 @@
{ {
"dependencies": { "dependencies": {
"undum": "git://github.com/sequitur/undum.git#commonjs", "undum": "git://github.com/sequitur/undum.git#commonjs",
"raconteur": "git://github.com/sequitur/raconteur.git#879543b4a9e773f61f439bbe1700cbf1e994ab4a", "raconteur": "git://github.com/sequitur/raconteur.git#61f60d3097b996c5ad9422bfbe3098c060ae92a1",
"jquery": "^2.1.3", "jquery": "^2.1.3",
"markdown-it": "^4.1.0" "markdown-it": "^4.1.0"
}, },