add assets task that copies everything from src/assets/ to public/

This commit is contained in:
Riku Rouvila
2014-02-19 14:51:11 +02:00
parent cc921524d4
commit 883427f8fa
3 changed files with 15 additions and 6 deletions

4
.gitignore vendored
View File

@@ -1,5 +1,3 @@
node_modules
public/*.html
public/css/*.css
public/js/*.js
public
vendor

View File

@@ -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)

View File

@@ -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"