Reputation: 261
I'd like to separate my JavaScript files from my Coffee-Script files!
This is my current file structure:
engine
world
behaviour.coffee
behaviour.js
character
behaviour.coffee
behaviour.js
engine.coffee
engine.js
This is the structure I would prefer:
src
engine
world
behaviour.coffee
character
behaviour.coffee
engine.coffee
and:
dest
engine
world
behaviour.js
character
behaviour.js
engine.js
my actual gulp file looks like this:
gulp = require 'gulp'
coffee = require 'gulp-coffee'
gulp.task 'all-coffee-files', ->
gulp.src './**/*.coffee'
.pipe coffee()
.pipe gulp.dest (file) ->
file.base
gulp.task 'watch', ->
gulp.watch './**/*.coffee', ['all-coffee-files']
What edits do I have to make in order to achieve this splitting?
Thank you very much!
Upvotes: 0
Views: 42
Reputation: 30564
Not really familiar with coffescript syntax, but the following should work:
gulp = require 'gulp'
coffee = require 'gulp-coffee'
gulp.task 'all-coffee-files', ->
gulp.src './src/**/*.coffee'
.pipe coffee()
.pipe gulp.dest('./dest/')
gulp.task 'watch', ->
gulp.watch './src/**/*.coffee', ['all-coffee-files']
This sources everything in ./src/
and places the resulting .js
files in ./dest/
, while keeping the directory structure intact.
Upvotes: 1