Last active
September 25, 2015 15:28
-
-
Save jdsimcoe/ab5640a68f9830a1819e to your computer and use it in GitHub Desktop.
Framer Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var EXPRESS_PORT = 4000; | |
var EXPRESS_ROOT = __dirname; | |
var LIVERELOAD_PORT = 35729; | |
function startExpress() { | |
var express = require('express'); | |
var app = express(); | |
app.use(require('connect-livereload')()); | |
app.use(express.static(EXPRESS_ROOT)); | |
app.listen(EXPRESS_PORT); | |
} | |
var lr; | |
function startLivereload() { | |
lr = require('tiny-lr')(); | |
lr.listen(LIVERELOAD_PORT); | |
} | |
function notifyLivereload(event) { | |
var fileName = require('path').relative(EXPRESS_ROOT, event.path); | |
lr.changed({ | |
body: { | |
files: [fileName] | |
} | |
}); | |
} | |
gulp.task('default', function () { | |
startExpress(); | |
startLivereload(); | |
gulp.watch('*.js', notifyLivereload); | |
gulp.watch('images/*.png', notifyLivereload); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "framer-server", | |
"version": "0.0.1", | |
"description": "Local development environment for Framer.js prototypes", | |
"main": "app.js", | |
"dependencies": { | |
"connect-livereload": "~0.3.2", | |
"express": "~3.5.1", | |
"gulp": "~3.6.0", | |
"gulp-embedlr": "~0.5.2", | |
"gulp-livereload": "~1.2.0", | |
"tiny-lr": "~0.0.5" | |
}, | |
"author": "Jonathan Simcoe" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment