bootstrap ui/site
parent
88a1e273da
commit
bd4d182306
|
@ -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") {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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']);
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
require('./util');
|
||||
require('./socket');
|
||||
require('./main');
|
Loading…
Reference in New Issue