 
 rev = require('gulp-rev')
 gzip = require('gulp-gzip')
+
+ASSETS_LOCATION = './public/assets'
+PUBLIC_LOCATION = './public'
+CORE_LOCATION = './app'
 
 watchReporter = (e)->
   util.log("File #{util.colors.cyan(e.path)} was #{util.colors.red(e.type)}, flexing 💪")

      useShortDoctype: true
      removeEmptyAttributes: true
    ))
    .pipe(gulp.dest('./public'))

gulp.task 'hashify', ['minify'], ->
  gulp.src('./public/assets/*.min.*')
    .pipe(rev())
    .pipe(gulp.dest('./public/assets/'))
    .pipe(rev.manifest())
    .pipe(rename('hashmap.json'))
    .pipe(gulp.dest('./public/assets/'))

gulp.task 'compress', ['hashify'], ->
  gulp.src('./public/assets/*.min-*.*')
    .pipe(gzip())
    .pipe(gulp.dest('./public/assets'))

  gulp.src('./public/*.css')
    .pipe(gzip())
    .pipe(gulp.dest('./public'))

gulp.task 'watch', ->
  compileJavascripts './app/javascripts/client/index.coffee',
    name: 'app.js'
    dest: './public/assets'
    watch: true

  stylesheets = [
    './app/stylesheets/**/*.styl'
    './vendor/**/*.css'
    './vendor/**/*.styl'
    '!./app/stylesheets/static.styl'
  ]
  gulp.watch(stylesheets).on 'change', (event)->
    watchReporter(event)
    compileStylesheets './app/stylesheets/index.styl',
      name: 'app.css'
      dest: './public/assets'

  templates = [
    './app/stylesheets/static.styl'
    './app/templates/static/**/*.jade'
  ]
  gulp.watch(templates).on 'change', (event)->
    watchReporter(event)
    compileStylesheets './app/stylesheets/static.styl',
      name: 'static.css'
      dest: './public'

    compileTemplates ['./app/templates/static/**/*.jade', '!./app/templates/static/**/_*.jade'],
      dest: './public'


gulp.task('default', ['browserify', 'stylus', 'static'])
gulp.task('build', ['compress'])

pkg = require('./package')
_ = require('lodash')

gulp = require('gulp')
util = require('gulp-util')
