From 883427f8fad131756340231a1a604242ca3e94dc Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Wed, 19 Feb 2014 14:51:11 +0200 Subject: [PATCH] add assets task that copies everything from src/assets/ to public/ --- .gitignore | 4 +--- README.md | 4 ++++ gulpfile.coffee | 13 ++++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 7c4c5e2..ec0836a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ node_modules -public/*.html -public/css/*.css -public/js/*.js +public vendor diff --git a/README.md b/README.md index c45c859..03a5293 100644 --- a/README.md +++ b/README.md @@ -23,5 +23,9 @@ * npm run build * Builds & minifies everything +## Development guidelines +* **public** - directory should be dedicated only to compiled/copied files from **src** - directory. + It should be possible to delete directory completely and after **npm start** or **npm run build** everything should be as they were before the deletation. + ## Enable LiveReload Install [LiveReload for Chrome](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei?hl=en) diff --git a/gulpfile.coffee b/gulpfile.coffee index 42c77c4..b5740d3 100644 --- a/gulpfile.coffee +++ b/gulpfile.coffee @@ -14,7 +14,6 @@ livereload = require 'gulp-livereload' reloadServer = lr() compileCoffee = (debug = false) -> - config = debug: debug transform: ['coffeeify'] @@ -51,15 +50,22 @@ compileStylus = (debug = false) -> styles.pipe(gulp.dest('public/css/')) .pipe livereload reloadServer +copyAssets = (debug = false) -> + gulp + .src('src/assets/**/*.*') + .pipe gulp.dest 'public/' + # Build tasks gulp.task "jade-production", -> compileJade() gulp.task 'stylus-production', ->compileStylus() gulp.task 'coffee-production', -> compileCoffee() +gulp.task 'assets-production', -> copyAssets() # Development tasks gulp.task "jade", -> compileJade(true) gulp.task 'stylus', -> compileStylus(true) gulp.task 'coffee', -> compileCoffee(true) +gulp.task 'assets', -> copyAssets(true) gulp.task "server", -> staticFiles = new nodeStatic.Server './public' @@ -76,9 +82,10 @@ gulp.task "watch", -> gulp.watch "src/coffee/*.coffee", ["coffee"] gulp.watch "src/jade/*.jade", ["jade"] gulp.watch "src/stylus/*.styl", ["stylus"] + gulp.watch "src/assets/**/*.*", ["assets"] gulp.task "build", -> - gulp.run "coffee-production", "jade-production", "stylus-production" + gulp.run "coffee-production", "jade-production", "stylus-production", "assets-production" gulp.task "default", -> - gulp.run "coffee", "jade", "stylus", "watch", "server" + gulp.run "coffee", "jade", "stylus", "assets", "watch", "server"