mirror of
https://github.com/Oreolek/raconteur-scaffold.git
synced 2024-04-28 23:19:21 +03:00
Set up Gulpfile
This commit is contained in:
parent
56661f62f6
commit
56a2a0ad68
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
build
|
||||||
|
dist
|
132
Gulpfile.js
132
Gulpfile.js
|
@ -0,0 +1,132 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/* Raconteur Gulpfile scaffold. */
|
||||||
|
/* Includes code adapted from Gulp documentation, among other sources. */
|
||||||
|
|
||||||
|
/* Imports */
|
||||||
|
var watchify = require('watchify'),
|
||||||
|
browserify = require('browserify'),
|
||||||
|
browserSync = require('browser-sync'),
|
||||||
|
gulp = require('gulp'),
|
||||||
|
source = require('vinyl-source-stream'),
|
||||||
|
gutil = require('gulp-util'),
|
||||||
|
coffeify = require('coffeeify'),
|
||||||
|
less = require('gulp-less'),
|
||||||
|
minifyCSS = require('gulp-minify-css'),
|
||||||
|
uglify = require('gulp-uglify'),
|
||||||
|
buffer = require('vinyl-buffer'),
|
||||||
|
_ = require('lodash');
|
||||||
|
|
||||||
|
var reload = browserSync.reload;
|
||||||
|
|
||||||
|
/* Tasks */
|
||||||
|
|
||||||
|
/* Trivial file copies */
|
||||||
|
|
||||||
|
function html (target) {
|
||||||
|
return function () {
|
||||||
|
return gulp.src('html/index.html')
|
||||||
|
.pipe(gulp.dest(target));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function img (target) {
|
||||||
|
return function () {
|
||||||
|
return gulp.src(['img/*.png', 'img/*.jpeg', 'img/*.jpg'])
|
||||||
|
.pipe(gulp.dest(target));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
gulp.task('html', html('./build'));
|
||||||
|
gulp.task('img', img('./build/img'));
|
||||||
|
|
||||||
|
/* Less */
|
||||||
|
|
||||||
|
gulp.task('less', function () {
|
||||||
|
gulp.src('less/main.less')
|
||||||
|
.pipe(less())
|
||||||
|
.pipe(gulp.dest('./build/css'));
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Generate JavaScript with browser sync. */
|
||||||
|
|
||||||
|
var customOpts = {
|
||||||
|
entries: ['./game/main.coffee'],
|
||||||
|
debug: true,
|
||||||
|
transform: [coffeify]
|
||||||
|
};
|
||||||
|
|
||||||
|
var opts = _.assign({}, watchify.args, customOpts);
|
||||||
|
var bundler = watchify(browserify(opts));
|
||||||
|
|
||||||
|
gulp.task('coffee', 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'))
|
||||||
|
.pipe(source('bundle.js'))
|
||||||
|
.pipe(gulp.dest('./build/game'));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Make a development build */
|
||||||
|
|
||||||
|
gulp.task('build', ['html', 'img', 'less', 'coffee'], function () {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Start a development server */
|
||||||
|
|
||||||
|
gulp.task('serve', ['build'], function () {
|
||||||
|
browserSync({
|
||||||
|
server: {
|
||||||
|
baseDir: 'build'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var lessListener = function () {
|
||||||
|
reload('./build/css/main.css');
|
||||||
|
}
|
||||||
|
|
||||||
|
gulp.watch(['./html/*.html'], ['html']);
|
||||||
|
gulp.watch(['./less/*.less'], ['less']);
|
||||||
|
gulp.watch(['./img/*.png', './img/*.jpeg', './img/*.jpg'], ['img']);
|
||||||
|
|
||||||
|
gulp.watch(['./build/css/main.css'], lessListener);
|
||||||
|
gulp.watch(
|
||||||
|
['./build/game/bundle.js', './build/img/*', './build/index.html'],
|
||||||
|
browserSync.reload);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Distribution tasks */
|
||||||
|
|
||||||
|
gulp.task('html-dist', html('./dist'));
|
||||||
|
gulp.task('img-dist', img('./dist/img'));
|
||||||
|
|
||||||
|
gulp.task('less-dist', function () {
|
||||||
|
return gulp.src('./less/main.less')
|
||||||
|
.pipe(less())
|
||||||
|
.pipe(minifyCSS())
|
||||||
|
.pipe(gulp.dest('./dist/css'));
|
||||||
|
});
|
||||||
|
|
||||||
|
var distBundler = browserify({
|
||||||
|
debug: false,
|
||||||
|
entries: ['./game/main.coffee'],
|
||||||
|
transform: ['coffeeify']
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('coffee-dist', function () {
|
||||||
|
return distBundler.bundle()
|
||||||
|
.pipe(source('bundle.js'))
|
||||||
|
.pipe(buffer())
|
||||||
|
.pipe(uglify())
|
||||||
|
.on('error', gutil.log)
|
||||||
|
.pipe(gulp.dest('./dist/game'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('dist', ['html-dist', 'img-dist', 'less-dist', 'coffee-dist'],
|
||||||
|
function () {
|
||||||
|
return;
|
||||||
|
});
|
|
@ -1,12 +1,11 @@
|
||||||
# Require the libraries we rely on
|
# Require the libraries we rely on
|
||||||
|
|
||||||
|
situation = require('raconteur/lib/situation.js')
|
||||||
|
situation.exportUndum() # Ensures our Undum object is the same as Raconteur's
|
||||||
$ = require('jquery')
|
$ = require('jquery')
|
||||||
undum = require('undum-commonjs')
|
oneOf = require('raconteur/lib/oneOf.js')
|
||||||
|
elements = require('raconteur/lib/elements.js')
|
||||||
situation = require('raconteur/situation.js')
|
qualities = require('raconteur/lib/qualities.js')
|
||||||
oneOf = require('raconteur/oneOf.js')
|
|
||||||
elements = require('raconteur/elements.js')
|
|
||||||
qualities = require('raconteur/qualities.js')
|
|
||||||
|
|
||||||
a = elements.a
|
a = elements.a
|
||||||
span = elements.span
|
span = elements.span
|
||||||
|
@ -23,18 +22,55 @@ undum.game.version = "0.1"
|
||||||
|
|
||||||
situation 'start',
|
situation 'start',
|
||||||
content: """
|
content: """
|
||||||
# Welcome to raconteur
|
![a storyteller](img/storyteller.jpg)
|
||||||
|
|
||||||
|
# Welcome to Raconteur
|
||||||
|
|
||||||
If you're seeing this, you've successfully installed the Raconteur game
|
If you're seeing this, you've successfully installed the Raconteur game
|
||||||
scaffold. Get writing!
|
scaffold. Get writing!
|
||||||
|
|
||||||
|
Raconteur lives at a [Github Repository], where you can report issues or
|
||||||
|
send feedback.
|
||||||
|
|
||||||
|
[Github Repository]: https://github.com/sequitur/raconteur
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Qualities
|
||||||
|
|
||||||
|
qualities
|
||||||
|
stats:
|
||||||
|
name: 'Statistics',
|
||||||
|
strength: qualities.integer('Strength', {priority: '001'}),
|
||||||
|
dexterity: qualities.integer('Dexterity', {priority: '002'}),
|
||||||
|
constitution: qualities.integer('Constitution', {priority: '003'}),
|
||||||
|
intelligence: qualities.integer('Intelligence', {priority: '004'}),
|
||||||
|
perception: qualities.integer('Perception', {priority: '005'}),
|
||||||
|
charisma: qualities.integer('Charisma', {priority: '006'})
|
||||||
|
possessions:
|
||||||
|
name: 'Possessions',
|
||||||
|
gold: qualities.integer('Gold'),
|
||||||
|
sword: qualities.wordScale('Sword', ['dull', 'sharp']),
|
||||||
|
shield: qualities.yesNo('Shield')
|
||||||
|
options:
|
||||||
|
extraClasses: ["possessions"]
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Initialise Undum
|
# Initialise Undum
|
||||||
|
|
||||||
undum.game.init = (character, system) ->
|
undum.game.init = (character, system) ->
|
||||||
# Add initialisation code here
|
# Add initialisation code here
|
||||||
|
character.qualities.strength = 10
|
||||||
|
character.qualities.dexterity = 12
|
||||||
|
character.qualities.constitution = 10
|
||||||
|
character.qualities.perception = 14
|
||||||
|
character.qualities.intelligence = 16
|
||||||
|
character.qualities.charisma = 8
|
||||||
|
character.qualities.gold = 100
|
||||||
|
character.qualities.sword = 1
|
||||||
|
character.qualities.shield = 1
|
||||||
|
|
||||||
# Get the party started when the DOM is ready.
|
# Get the party started when the DOM is ready.
|
||||||
|
|
||||||
$(undum.begin)
|
$(-> undum.begin())
|
|
@ -5,10 +5,10 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<!-- EDIT: Game title -->
|
<!-- EDIT: Game title -->
|
||||||
<title>Raconteur Game Template</title>
|
<title>Raconteur Scaffold</title>
|
||||||
|
|
||||||
<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/undum.css">
|
<link rel="stylesheet" href="css/main.css">
|
||||||
<script type="text/javascript" src="game/bundle.js"></script>
|
<script type="text/javascript" src="game/bundle.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
BIN
img/storyteller.jpg
Normal file
BIN
img/storyteller.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
|
@ -292,14 +292,15 @@ a {
|
||||||
transition: color 0.1s ease-in;
|
transition: color 0.1s ease-in;
|
||||||
}
|
}
|
||||||
a.raw {
|
a.raw {
|
||||||
padding-right: 14px;
|
// External link
|
||||||
background: transparent url("../img/external_link.png") no-repeat right 4px;
|
border-bottom: 1px dashed @anchor-colour;
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
color: lighten(@anchor-colour, 10%);
|
color: lighten(@anchor-colour, 10%);
|
||||||
}
|
}
|
||||||
|
|
||||||
img.float_right {
|
img {
|
||||||
|
.material_shadow();
|
||||||
float: right;
|
float: right;
|
||||||
margin: 1.1em 0 1.1em 1.1em;
|
margin: 1.1em 0 1.1em 1.1em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,12 @@
|
||||||
"babelify": "^6.0.2",
|
"babelify": "^6.0.2",
|
||||||
"browser-sync": "^2.6.0",
|
"browser-sync": "^2.6.0",
|
||||||
"browserify": "^9.0.8",
|
"browserify": "^9.0.8",
|
||||||
|
"coffeeify": "^1.0.0",
|
||||||
"gulp": "^3.8.11",
|
"gulp": "^3.8.11",
|
||||||
|
"gulp-gzip": "^1.1.0",
|
||||||
"gulp-less": "^3.0.2",
|
"gulp-less": "^3.0.2",
|
||||||
"gulp-sourcemaps": "^1.5.1",
|
"gulp-minify-css": "^1.0.0",
|
||||||
|
"gulp-uglify": "^1.2.0",
|
||||||
"gulp-util": "^3.0.4",
|
"gulp-util": "^3.0.4",
|
||||||
"lodash": "^3.6.0",
|
"lodash": "^3.6.0",
|
||||||
"vinyl-buffer": "^1.0.0",
|
"vinyl-buffer": "^1.0.0",
|
||||||
|
|
Loading…
Reference in a new issue