Skip to content

Instantly share code, notes, and snippets.

@josephj
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephj/d4edf708bbea2c95f168 to your computer and use it in GitHub Desktop.
Save josephj/d4edf708bbea2c95f168 to your computer and use it in GitHub Desktop.
Development tools for developer portal project
################
# Dependencies
################
gulp = require 'gulp'
watch = require 'gulp-watch'
connect = require 'gulp-connect'
open = require 'gulp-open'
path = require 'path'
exec = require('child_process').exec
################
# Constants
################
WEB_HOST = 'localhost'
WEB_PORT = 6002
WEB_ROOT = 'app/public/'
LIVERELOAD_PORT = 35719
gulp.task 'connect', ->
connect.server
host: WEB_HOST
port: WEB_PORT
root: WEB_ROOT
livereload:
port: LIVERELOAD_PORT
gulp.task 'build', ->
exec "cd #{WEB_ROOT}; phr up"
gulp.task 'open', ->
gulp.src "#{WEB_ROOT}index.html"
.pipe open('', url: "http://#{WEB_HOST}:#{WEB_PORT}")
gulp.task 'watch', ->
watch "#{WEB_ROOT}.phrozn/**/*.twig", (vinyl) ->
file = path.basename(vinyl.history)
cmd = "cd #{WEB_ROOT}; phr single #{file} .phrozn"
console.log "Executing '#{cmd}'"
exec cmd
watch "#{WEB_ROOT}**/*.html", ->
gulp.src "#{WEB_ROOT}**/*.html"
.pipe connect.reload()
gulp.task('default', ['build', 'connect', 'open', 'watch']);
require('coffee-script/register');
require('./gulpfile.coffee');
{
"devDependencies": {
"coffee-script": "^1.8.0",
"gulp": "^3.8.10",
"gulp-connect": "^2.2.0",
"gulp-open": "^0.3.2",
"gulp-watch": "^4.2.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment