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');
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",
......
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