sweetbuild
A Sweet.js DSL for Broccoli, the best frontend asset pipeline.
Usage
$ npm install --save-dev sweet.js sweetbuild broccoli broccoli-merge-trees
Put the following in Brocfile.js
:
;moduleexports = ;
Put your build script in Brocfile.sjs
(or whatever you required in Brocfile.js
) and use Broccoli like you normally do.
The macros
brequire
A shorthand for require
.
Requires some_thing
from broccoli-some-thing
.
brequire source_map; // requires broccoli-source-map as source_map
+++ and +!+
Operators that merge trees using broccoli-merge-trees.
They are left-associative.
+!+
is the {overwrite: true}
version.
You can use both single trees and lists of trees at both sides.
var scripts = 'src' +++ 'vendor/src';var styles = 'normalize' 'formalize' +++ 'stylesheets' 'ie-stylesheets' +!+ 'vendor/stylesheets';
->
The chain operator. Like the UNIX pipe for plugin calls. Best understood by example:
var scripts = 'src/main/coffee' -> -> uglify_js;// same as:var scripts = ;
A complete example
brequire coffee;brequire uglify_js;brequire sass;brequire manifest; var scripts = 'vendor/js' +++ 'cs' -> coffee -> uglify_js; var styles = 'vendor/css' +++ 'vendor/sass' +++ 'sass' -> ; var assets = scripts +++ styles; moduleexports = assets +++ ;
License
Copyright © 2014 myfreeweb This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.