Skip to content
Snippets Groups Projects
Unverified Commit c2af088e authored by Shrimadhav U K's avatar Shrimadhav U K
Browse files

Fix failing JSON build

parent 60e6baa9
Branches
No related merge requests found
...@@ -17,6 +17,8 @@ var glob = require('glob'); ...@@ -17,6 +17,8 @@ var glob = require('glob');
var yaml = require('gulp-yaml'); var yaml = require('gulp-yaml');
var sortJSON = require('gulp-json-sort').default; var sortJSON = require('gulp-json-sort').default;
var fs = require('fs');
gulp.task('assetscopy', function() { gulp.task('assetscopy', function() {
gulp.src([ gulp.src([
...@@ -68,7 +70,7 @@ gulp.task('GenerateEventsYAML', function() { ...@@ -68,7 +70,7 @@ gulp.task('GenerateEventsYAML', function() {
}); });
gulp.task('GenerateEventsJSON', function() { gulp.task('GenerateEventsJSON', function() {
gulp.src('public/events/index.yaml') return gulp.src('public/events/index.yaml')
.pipe(yaml()) .pipe(yaml())
.pipe(sortJSON({ .pipe(sortJSON({
cmp: function(a, b) { cmp: function(a, b) {
...@@ -80,17 +82,21 @@ gulp.task('GenerateEventsJSON', function() { ...@@ -80,17 +82,21 @@ gulp.task('GenerateEventsJSON', function() {
}); });
gulp.task('GenerateEventsIndex', function() { gulp.task('GenerateEventsIndex', function() {
var sortedEvents = require('./public/events/index.json'); fs.readFile('./public/events/index.json', "utf-8", function(err, sortedEvents){
gulp.src('pug/templates/events.pug') if(err){
.pipe(pug({ throw err;
pretty: true, }
data: { gulp.src('pug/templates/events.pug')
debug: true, .pipe(pug({
events: sortedEvents pretty: true,
} data: {
})) debug: true,
.pipe(concat('index' + '.html')) events: JSON.parse(sortedEvents)
.pipe(gulp.dest('public/events')); }
}))
.pipe(concat('index' + '.html'))
.pipe(gulp.dest('public/events'));
});
}); });
gulp.task('GenerateEventPages', function() { gulp.task('GenerateEventPages', function() {
...@@ -117,10 +123,9 @@ gulp.task('GenerateEventPages', function() { ...@@ -117,10 +123,9 @@ gulp.task('GenerateEventPages', function() {
gulp.task('pughtml', function() { gulp.task('pughtml', function() {
runSequence( runSequence(
'GenerateIndexPage', ['GenerateIndexPage', 'GenerateEventPages'],
'GenerateEventsYAML', 'GenerateEventsYAML',
'GenerateEventsJSON', 'GenerateEventsJSON',
'GenerateEventPages',
'GenerateEventsIndex' 'GenerateEventsIndex'
) )
}); });
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"homepage": "https://fsug.in", "homepage": "https://fsug.in",
"devDependencies": { "devDependencies": {
"connect-livereload": "^0.5.4", "connect-livereload": "^0.5.4",
"fs": "0.0.1-security",
"glob": "^7.1.2", "glob": "^7.1.2",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment