Skip to content

Instantly share code, notes, and snippets.

@wwqrd
Created November 14, 2012 13:47
Show Gist options
  • Save wwqrd/4072173 to your computer and use it in GitHub Desktop.
Save wwqrd/4072173 to your computer and use it in GitHub Desktop.
Example Jakefile.js
namespace('test', function () {
desc('Run server tests');
task('server', [], function () {
jake.exec('mocha spec', function () {
console.log('Server tests passed');
complete();
});
});
desc('Run client tests');
task('client', [], function () {
});
desc('Run server and client tests');
task('all', ['test:server', 'test:client'], function () {
console.log('Server and client tests passed');
});
});
namespace('clean', function () {
desc('Clean CSS');
task('css', [], function () {
jake.rmRf('public/css');
jake.mkdirP('public/css');
console.log('Cleaned public/css');
});
desc('Clean JS');
task('js', [], function () {
jake.rmRf('public/js');
jake.mkdirP('public/js');
console.log('Cleaned public/js');
});
desc('Clean images');
task('img', [], function () {
jake.rmRf('public/img');
jake.mkdirP('public/img');
console.log('Cleaned public/img');
});
desc('Cleaning everything');
task('all', ['clean:css','clean:js','clean:img'], function () {
console.log('Cleaned everything');
});
});
namespace('build', function () {
desc('Build less');
task('less', ['clean:css'], function () {
jake.exec('lessc -x assets/less/main.less > public/css/main.css', function () {
console.log('Built less');
complete();
}, { printStdout: true });
});
desc('Build javascript');
task('js', ['clean:js'], function () {
jake.exec('r.js -o build.r.js', function () {
console.log('Built javascript');
complete();
}, { printStdout: true });
});
desc('Copy images');
task('img', ['clean:img'], function () {
jake.cpR('assets/img', 'public');
console.log('Images copied');
});
desc('Build everything');
task('all', ['test:all','clean:all','build:less','build:js','build:img'], function () {
});
});
task('default', ['build:all'], function () {
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment