diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 373ab45231694264e56c8bfc8b7c319c8d45b100..f7165a722483757ca06f10daab8e2077429bb2da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,5 +7,9 @@ pages: artifacts: paths: - public + cache: + paths: + - node_modules + key: project only: - master diff --git a/gulpfile.js b/gulpfile.js index c7e0fbe407f439a35a15161644ed548dd9cc5638..852d17b548dd97b942696cf1bff8f139235fbaee 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,6 +11,7 @@ var connect = require('gulp-connect'); var connectProxy = require('gulp-connect-proxy'); var yamlinc = require("gulp-yaml-include"); +var runSequence = require('run-sequence'); var readYaml = require('read-yaml'); var glob = require("glob"); @@ -46,7 +47,7 @@ gulp.task('jslint', function() { .pipe(jshint.reporter('default')); }); -gulp.task('pughtml', function() { +gulp.task('GenerateIndexPage', function(){ gulp.src('pug/pages/*.pug') .pipe(pug({ pretty: true, @@ -55,48 +56,54 @@ gulp.task('pughtml', function() { } })) .pipe(gulp.dest('public')); - var yamlData = gulp.src("events/index.yaml") +}); + +gulp.task('GenerateEventsYAML', function(){ + return gulp.src("events/index.yaml") .pipe(yamlinc()) .pipe(gulp.dest('public/events')); +}) + +gulp.task('GenerateEventsPage', function(){ + readYaml('public/events/index.yaml', function(err, ydata) { + if (err) throw err; + gulp.src('pug/templates/events.pug') + .pipe(pug({ + pretty: true, + data: { + debug: true, + events: ydata + } + })) + .pipe(concat('index' + '.html')) + .pipe(gulp.dest('public/events')); + }); + glob("events/TheRealEvents/*.yaml", {}, function (er, files) { + var nooffiles = files.length; + for(var i = 0; i < nooffiles; i++){ + readYaml(files[i], function(err, ydata) { + if (err) throw err; + var id = ydata.id; + gulp.src('pug/templates/individual_event_page.pug') + .pipe(pug({ + pretty: true, + data: { + debug: true, + evt: ydata + } + })) + .pipe(concat(id + '.html')) + .pipe(gulp.dest('public/events')); + }); + } + }); +}) - readYaml('public/events/index.yaml', function(err, ydata) { - // if (err) throw err; - gulp.src('pug/templates/events.pug') - .pipe(pug({ - pretty: true, - data: { - debug: true, - events: ydata - } - })) - .pipe(concat('index' + '.html')) - .pipe(gulp.dest('public/events')); - }); - // options is optional - glob("events/TheRealEvents/*.yaml", {}, function (er, files) { - // files is an array of filenames. - // If the `nonull` option is set, and nothing - // was found, then files is ["**/*.js"] - // er is an error object or null. - var nooffiles = files.length; - for(var i = 0; i < nooffiles; i++){ - readYaml(files[i], function(err, ydata) { - if (err) throw err; - var id = ydata.id; - gulp.src('pug/templates/individual_event_page.pug') - .pipe(pug({ - pretty: true, - data: { - debug: true, - evt: ydata - } - })) - .pipe(concat(id + '.html')) - .pipe(gulp.dest('public/events')); - }); - - } - }); +gulp.task('pughtml', function(){ + runSequence('GenerateEventsYAML',[ + 'GenerateIndexPage', + 'GenerateEventsPage' + ]) }); gulp.task('cssmin', function() { diff --git a/package.json b/package.json index 2727f9047ae75b7621ff8a8dee4b029325597f97..a13a5124b5c84cc04a36b8940ffe55af9509c006 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "gulp-uglify": "^3.0.0", "gulp-yaml-data": "^0.2.0", "gulp-yaml-include": "^0.2.0", - "read-yaml": "^1.1.0" + "read-yaml": "^1.1.0", + "run-sequence": "^1.2.2" }, "dependencies": { "Respond.js": "git+https://github.com/scottjehl/Respond.git#1.4.0",