Answer the question
In order to leave comments, you need to log in
Gulp.js and modular coffeescript?
Tell me how to set up gulpfile to build modules written in coffeescript
There are two files
define [], ->
"My string"
define ['partials/extra.coffee'], (extra)->
console.log "Returned: #{extra}"
# ==============================
# CoffeeScript
# ==============================
coffee = require 'gulp-coffee'
coffeelint = require 'gulp-coffeelint'
jshint = require 'gulp-jshint'
stylish = require 'jshint-stylish'
uglify = require 'gulp-uglify'
gulp.task 'coffee', ->
gulp.src path.src.coffee
.pipe plumber
errorHandler: handleError
.pipe do rigger
.pipe do sourcemaps.init
.pipe do coffeelint.reporter
.pipe coffeelint.reporter('fail')
.pipe do coffee
.pipe do jshint
.pipe jshint.reporter stylish
.pipe do sourcemaps.write
.pipe gulpif ifProd, do uglify
.pipe gulp.dest path.build.js
.pipe reload
stream: true
Answer the question
In order to leave comments, you need to log in
I'll answer my own question
. Here's a solution.
bundler = ->
browserify
entries: [ path.src.coffee ]
extensions: ['.coffee', '.js']
debug : true
.transform 'coffeeify'
.transform 'deamdify'
.bundle()
.on 'error', handleError
.pipe source 'main.js'
.pipe gulp.dest path.build.js
.pipe reload
stream: true
gulp.task 'coffee', ->
gulp.src path.src.coffee, read: false
.pipe plumber
errorHandler: handleError
.pipe tap bundler
define [], ->
"My string"
define ['./partials/extra'], (extra) ->
console.log "Returned: #{extra}"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question