var compress = require('compression');
var config   = require('../config').html;
var express  = require('express');
var gulp     = require('gulp');
var gutil    = require('gulp-util');

var serverTask = function() {
	if (config.nunjucks && config.productionServer) {
		var url = 'http://localhost:8008';

		express()
			.use(compress())
			.use('/', express.static('dist', {
				maxAge: 60*60*24
			}))
			.listen(8008)

		gutil.log('Server started on: ' + gutil.colors.magenta(url))
	}
}

gulp.task('server', serverTask);
