diff --git a/.gitignore b/.gitignore index fdd0ea3..eabf113 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/* lib/* css/* /api/resultats.json +/index.html diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 96a2d04..7dddb11 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ pages: stage: deploy script: - npm install - - node_modules/.bin/gulp + - node_modules/.bin/gulp prod - rm -rf node_modules .public public - mkdir .public - cp -r * .public diff --git a/gulpfile.js b/gulpfile.js index c3ae212..45e71a6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,7 +3,9 @@ var bower = require('gulp-bower'); var help = require('gulp-task-listing'); var clean = require('gulp-clean'); var sass = require('gulp-sass'); +var rename = require("gulp-rename"); var yaml = require('gulp-yaml'); +var template = require('gulp-template'); var webserver = require('gulp-webserver'); gulp.task('help', help); @@ -32,8 +34,25 @@ gulp.task('compile-results', function(){ .pipe(gulp.dest('./api')); }); +gulp.task('template-prod', function () { + return gulp.src('index.tmpl.html') + .pipe(rename("index.html")) + .pipe(template({production: true})) + .pipe(gulp.dest('.')); +}); + +gulp.task('template-dev', function () { + return gulp.src('index.tmpl.html') + .pipe(rename("index.html")) + .pipe(template({production: false})) + .pipe(gulp.dest('.')); +}); + + gulp.task('default', ['bower', 'sass', 'compile-results']); +gulp.task('prod', ['default', 'template-prod']); + gulp.task('webserver', function(){ return gulp.src('.') .pipe(webserver({ @@ -42,8 +61,8 @@ gulp.task('webserver', function(){ })); }); -gulp.task('dev', ['default', 'webserver'], function(){ +gulp.task('dev', ['default', 'webserver', 'template-dev'], function(){ gulp.watch('./scss/*.scss', ['sass']); + gulp.watch('*.tmpl.html', ['template-dev']); return gulp.watch('./data/*.yaml', ['compile-results']); - }); diff --git a/index.html b/index.tmpl.html similarity index 66% rename from index.html rename to index.tmpl.html index 5dd5c31..754acec 100644 --- a/index.html +++ b/index.tmpl.html @@ -6,8 +6,12 @@ -
+ <%if(production){ %> + + <% }else{ %> + + <% } %>