 pug = require 'pug'
 slug = require 'slug'
 _assign = require 'lodash/assign'
+_has = require 'lodash/has'
+_find = require 'lodash/find'
 mkdirp = require 'mkdirp'
 fs = require 'fs'
+path = require 'path'
 moment = require 'moment'
 
 

    )
    unless proceed then return

    destination = null


    data = @grabFrontAndContent file.data
    title_slug = slug(data.title, @slug)
    dates = moment(data.published).format('Y/MM/DD')
    path = "#{@pub_path}/#{dates}/#{title_slug}"

    if data.layout?
      template_path = "#{@layout_root}/layouts/#{data.layout}.jade"
      data.content = @applyTemplate template_path, data

    mkdirp path, (er) ->
      fs.writeFile "#{path}/index.html", data.content, (er) ->
        console.log 'Done.'

  paths:
    layouts: 'layouts'
    content: 'content'
    public: 'public'
    root: 'blog'

  fields:
    title: 'title'
    date: 'published'

  wrap_html: yes
  slugify: yes

  marked:
    gfm: yes
