Last active
January 3, 2016 00:08
-
-
Save mgutz/8380446 to your computer and use it in GitHub Desktop.
Projmate built on gulp filters syntax. Projmate can be run in imperative mode meaning it will run JavaScript or CoffeeScript files with the usual require and function goodness. It also runs project files in JSON in JSON, CSON or YAML format. The JSON mode is for the Projmate GUI. The JSON file can be edited by hand or the GUI and it is round-tri…
This file contains hidden or 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
Promise = require("bluebird") | |
coffee = require("gulp-coffee") | |
dest = require("gulp").dest | |
less = require("gulp-less") | |
uglify = require("gulp-uglify") | |
exports.imports = | |
S: "./simple.coffee" | |
exports.project = (pm) -> | |
{argv, $} = pm | |
# default not required but invoked if found | |
default: "scripts asyncTask stylesheets S:helloWorld" | |
scripts: | |
deps: "asyncTask" | |
files: "src/**/*.{coffee,js}" | |
rebuild: "all" | |
pipeline: -> [ | |
coffee $when: "extname === '.coffee'" | |
uglify $mode: "release" | |
dest 'build' | |
] | |
# create a release mode pipeline if the $mode exclude flag is too simple | |
release: -> [ | |
] | |
stylesheets: | |
files: "src/css/**/*.less !src/css/foo/" | |
pipeline: -> [ | |
less() | |
dest('build') | |
] | |
clean: | |
description: "Clean the build directory" | |
cmd: -> | |
$.rm '-rf', 'build' | |
# promisified shell to run node and coffee (for Windows lacking chmod +x) | |
$ | |
.node('script1.js') | |
.coffee('script2.coffe') | |
# plays nice with callback | |
asyncCallback: (next) -> | |
setTimeout -> | |
console.log pm.argv.message | |
next() | |
, 5 | |
# promise aware :) | |
asyncPromise: -> | |
vow = Promise.pending() | |
setTimeout -> | |
console.log 'promise' | |
vow.fulfill() | |
, 10 | |
vow.promise | |
This file contains hidden or 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
functions: | |
H: "./helpers" | |
filters: | |
coffee: "gulp-coffee" | |
dest: "gulp#dest" | |
less: "gulp-less" | |
uglify: "gulp-uglify" | |
imports: | |
S: "./simple.coffee" | |
all: "scripts asyncTask stylesheets S:helloWorld" | |
scripts: | |
deps: "asyncTask" | |
description: "Compiles JavaScript and CoffeeScript" | |
files: "src/**/*.{coffee,js}" | |
rebuild: "all" | |
pipeline: [ | |
{ coffee: { $when: "extname === '.coffee'" }} | |
{ uglify: { $mode: "release"}} | |
{ dest: 'build' } | |
] | |
stylesheets: | |
desc: "Builds stylesheets" | |
files: "src/css/**/*.less !src/css/foo/" | |
pipeline: [ | |
{ less: [] } | |
{ dest: 'build'} | |
] | |
default: | |
desc: "Print message" | |
command: "(H.print 'default run')" | |
asyncTask: "(H.printAsync next)" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment