2015-04-30 13:54:25 +00:00
|
|
|
gulp = require('gulp')
|
|
|
|
glob = require('glob')
|
|
|
|
path = require('path')
|
|
|
|
source = require('vinyl-source-stream')
|
|
|
|
spawn = require('child_process').spawn
|
2015-07-05 17:14:28 +00:00
|
|
|
webpack = require('webpack')
|
2015-04-30 13:54:25 +00:00
|
|
|
|
|
|
|
gulp.task 'scripts', ->
|
2015-07-05 17:14:28 +00:00
|
|
|
glob './themes/**/coffee/app.coffee', (err, files) ->
|
2015-04-30 13:54:25 +00:00
|
|
|
files.forEach (file) ->
|
2015-07-05 17:14:28 +00:00
|
|
|
parts = file.split(path.sep)
|
|
|
|
context = path.resolve(parts.slice(0, -1).join(path.sep))
|
|
|
|
entry = ['.'].concat(parts.slice(-1)).join(path.sep)
|
|
|
|
|
|
|
|
outputPath = path.resolve(parts.slice(0, -2).concat(['js']).join(path.sep))
|
|
|
|
|
|
|
|
console.log context
|
|
|
|
console.log entry
|
|
|
|
console.log outputPath
|
|
|
|
|
|
|
|
compiler = webpack(
|
|
|
|
entry: entry
|
|
|
|
context: context
|
|
|
|
output:
|
|
|
|
path: outputPath
|
|
|
|
filename: 'app.js'
|
|
|
|
)
|
2015-04-30 13:54:25 +00:00
|
|
|
|
|
|
|
gulp.task 'default', ['watch']
|