Shrimadhav U K

Fix failing JSON build

......@@ -17,6 +17,8 @@ var glob = require('glob');
var yaml = require('gulp-yaml');
var sortJSON = require('gulp-json-sort').default;
var fs = require('fs');
gulp.task('assetscopy', function() {
gulp.src([
......@@ -68,7 +70,7 @@ gulp.task('GenerateEventsYAML', function() {
});
gulp.task('GenerateEventsJSON', function() {
gulp.src('public/events/index.yaml')
return gulp.src('public/events/index.yaml')
.pipe(yaml())
.pipe(sortJSON({
cmp: function(a, b) {
......@@ -80,17 +82,21 @@ gulp.task('GenerateEventsJSON', function() {
});
gulp.task('GenerateEventsIndex', function() {
var sortedEvents = require('./public/events/index.json');
gulp.src('pug/templates/events.pug')
.pipe(pug({
pretty: true,
data: {
debug: true,
events: sortedEvents
}
}))
.pipe(concat('index' + '.html'))
.pipe(gulp.dest('public/events'));
fs.readFile('./public/events/index.json', "utf-8", function(err, sortedEvents){
if(err){
throw err;
}
gulp.src('pug/templates/events.pug')
.pipe(pug({
pretty: true,
data: {
debug: true,
events: JSON.parse(sortedEvents)
}
}))
.pipe(concat('index' + '.html'))
.pipe(gulp.dest('public/events'));
});
});
gulp.task('GenerateEventPages', function() {
......@@ -117,10 +123,9 @@ gulp.task('GenerateEventPages', function() {
gulp.task('pughtml', function() {
runSequence(
'GenerateIndexPage',
['GenerateIndexPage', 'GenerateEventPages'],
'GenerateEventsYAML',
'GenerateEventsJSON',
'GenerateEventPages',
'GenerateEventsIndex'
)
});
......
......@@ -11,6 +11,7 @@
"homepage": "https://fsug.in",
"devDependencies": {
"connect-livereload": "^0.5.4",
"fs": "0.0.1-security",
"glob": "^7.1.2",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",
......