bootstrap ui/site

ui/site
Thibault Duplessis 2017-03-09 14:48:30 +01:00
parent 88a1e273da
commit bd4d182306
12 changed files with 133 additions and 13 deletions

View File

@ -191,21 +191,9 @@ withGtm: Boolean = false)(body: Html)(implicit ctx: Context)
</div>
</div>
}
@if(!isProd) { @jQueryTag }
@if(chessground) {@jsTag("vendor/chessground.min.js")}
@if(ctx.requiresFingerprint) { @fingerprintTag }
@if(isProd) {
@jsTagCompiled("lichess.js")
@momentLangTag
} else {
@momentjsTag
@momentLangTag
@jsTag("jquery.fill.js")
@jsTag("deps.min.js")
@jsTag("util.js")
@jsTag("socket.js")
@jsTag("main.js")
}
@jsAt(s"compiled/lichess.site${if(isProd) ".min" else ""}.js")
@if(withGtm) { @embedJs { dataLayer = []; } }
@moreJs
@if(lang.language != "en") {

23
lichess.js 100644

File diff suppressed because one or more lines are too long

7
ui/site/dep/moment.min.js vendored 100644

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,75 @@
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var watchify = require('watchify');
var browserify = require('browserify');
var uglify = require('gulp-uglify');
var streamify = require('gulp-streamify');
var concat = require('gulp-concat');
var sources = ['./src/index.js'];
var destination = '../../public/compiled/';
var onError = function(error) {
gutil.log(gutil.colors.red(error.message));
};
var standalone = 'Lichess';
gulp.task('prod-source', function() {
return browserify('./src/index.js', {
standalone: standalone
}).bundle()
.on('error', onError)
.pipe(source('lichess.site.source.min.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest('./dist'));
});
gulp.task('dev-source', function() {
return browserify('./src/index.js', {
standalone: standalone
}).bundle()
.on('error', onError)
.pipe(source('lichess.site.source.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('watch', function() {
var opts = watchify.args;
opts.debug = true;
opts.standalone = standalone;
var bundleStream = watchify(browserify(sources, opts))
.on('update', rebundle)
.on('log', gutil.log);
function rebundle() {
return bundleStream.bundle()
.on('error', onError)
.pipe(source('lichess.site.js'))
.pipe(gulp.dest(destination))
.pipe(addDepsTo('lichess.site.js'));
}
return rebundle();
});
function addDepsTo(filename) {
return function() {
return gulp.src([
'./dep/jquery.min.js',
'./src/jquery.fill.js',
'./dep/moment.min.js',
'./dep/misc.min.js',
'./dist/' + filename
])
.pipe(concat(filename.replace('source.', '')))
.pipe(gulp.dest(destination));
};
}
gulp.task('dev-bundle', addDepsTo('lichess.site.source.js'));
gulp.task('prod-bundle', addDepsTo('lichess.site.source.min.js'));
gulp.task('default', ['watch']);
gulp.task('dev', ['dev-source', 'dev-bundle']);
gulp.task('prod', ['prod-source', 'prod-bundle']);

View File

@ -0,0 +1,24 @@
{
"name": "site",
"version": "1.0.0",
"description": "lichess.org website",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Thibault Duplessis",
"license": "AGPL-3.0",
"devDependencies": {
"browserify": "^14",
"gulp": "^3",
"gulp-streamify": "^1",
"gulp-uglify": "^2",
"gulp-util": "^3",
"uglify-js": "^2",
"vinyl-source-stream": "^1",
"watchify": "^3"
},
"dependencies": {
"gulp-concat": "^2.6.1"
}
}

View File

@ -0,0 +1,3 @@
require('./util');
require('./socket');
require('./main');