Last active
December 14, 2015 01:59
-
-
Save edom18/5010285 to your computer and use it in GitHub Desktop.
This is a Cakefile by coffee script to watch and compile cofee scripts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{spawn, exec} = require 'child_process' | |
option '-o', '--output [DIR]', 'Output directory.' | |
option '-t', '--target [DIR]', 'Watch target directory.' | |
stdout_handler = (data) -> | |
console.log data.toString().trim() | |
build = (watch, output = 'js', target = '_src/coffee') -> | |
console.log 'Watching coffee scripts' | |
console.log "Watch to #{target}" | |
options = ['-cb', '-o', output, target] | |
if watch is true | |
options[0] = '-cbw' | |
coffee = spawn 'coffee', options | |
coffee.stdout.on 'data', stdout_handler | |
style = (watch) -> | |
console.log 'Watching compass files.' | |
options = ['compile'] | |
if watch is true | |
options = ['watch', './'] | |
compass = spawn 'compass', options | |
compass.stdout.on 'data', (data) -> stdout_handler | |
compass.stderr.on 'data', (data) -> stdout_handler | |
task 'build', 'build the project', (watch) -> | |
build watch | |
task 'watch', 'watch for changes and rebuild', (options) -> | |
build true, options.output, options.target | |
style true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment