 watch = require 'gulp-watch'
 prerender = require './prerender'
 
-loadEntries = (src) ->
+loadEntriesV3 = (src) ->
   myjekyll = require 'myjekyll'
   moment = require 'moment'
   marked = require 'marked'

      if titleKey is 'diary' then null else dir + '/diary/index.html'
      dir + '/index.html'
    ].filter (i) -> i
  .concat [
    paths: ['index.html']
    entry: null
  ]

ignoreError = (stream) ->
  stream.on 'error', (e) ->


gulp.task 'build-html', ->
  baseDir = './dist/'
  loadEntriesV3('./data/**/*.md').forEach ({ paths, entry }) ->
    paths.forEach (path) ->
      prerender(baseDir + path, entry)
  prerender(baseDir + 'index.html', null)

gulp.task 'build-html-dev', ->
  baseDir = './dist/'
  loadEntriesV3('./data/nofile.md').forEach ({ paths, entry }) ->
    paths.forEach (path) ->
      prerender(baseDir + path, entry)
  prerender(baseDir + 'index.html', null)

gulp.task 'build-images', ->
  gulp.src './src/images/*'
