Skip to content

Commit

Permalink
Merge branch 'feature-auto-insert-build-date' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbonhomme committed Feb 3, 2017
2 parents e7e5601 + 4525db2 commit e60d033
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
12 changes: 10 additions & 2 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import rimraf from 'rimraf';
import sherpa from 'style-sherpa';
import yaml from 'js-yaml';
import fs from 'fs';
import rsync from 'gulp-rsync';

// Load all Gulp plugins into one variable
const $ = plugins();
Expand Down Expand Up @@ -52,6 +51,7 @@ function copy() {
// Copy page templates into finished HTML files
function pages() {
return gulp.src('src/pages/**/*.{html,hbs,handlebars}')
.pipe($.if('index.html', setBuildDate()))
.pipe(panini({
root: 'src/pages/',
layouts: 'src/layouts/',
Expand Down Expand Up @@ -155,7 +155,7 @@ function deploy() {
var remoteDir = PRODUCTION ? '/var/www/alexetmanon-www' : '/var/www/beta-alexetmanon-www';

return gulp.src(globs)
.pipe(rsync({
.pipe($.rsync({
root: 'dist',
username: process.env.SSH_USER,
hostname: process.env.SSH_HOST,
Expand All @@ -164,4 +164,12 @@ function deploy() {
recursive: true,
incremental: true,
}));
}

// Set the build date in the index file
function setBuildDate() {
var now = new Date();
var months = "janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_");

return $.stringReplace('{buildDate}', months[now.getMonth()] + ' ' + now.getFullYear());
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"gulp-rsync": "0.0.7",
"gulp-sass": "^2.1.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-string-replace": "^0.4.0",
"gulp-uglify": "^1.2.0",
"gulp-uncss": "^1.0.1",
"js-yaml": "^3.4.6",
Expand All @@ -53,4 +54,4 @@
"dependencies": {
"mfb": "^0.12.0"
}
}
}
2 changes: 1 addition & 1 deletion src/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ <h4 class="aetm--footer--subtitle">les artisans de l'application mobile à Lille
</div>
</div>

<p class="aetm--footer--legals">Conception : alex et manon. Dernière mise à jour : février 2017 - Tous droits réservés.</p>
<p class="aetm--footer--legals">Conception : alex et manon. Dernière mise à jour : {buildDate} - Tous droits réservés.</p>
</footer>

<!-- FAB -->
Expand Down

0 comments on commit e60d033

Please # to comment.