Zero-config
Get started immediately. No need to learn configuration formats or new syntax. Create tasks using the language you already know. Using native modules is encouraged along the built-in helpers.
flour works within a Cakefile. Work for supporting other build systems like jake, grunt, etc. is underway.
npm install flour
npm install coffee-script uglify-js stylus
flour = require 'flour'
task 'build:coffee', ->
# Compile CoffeeScript
compile 'app.coffee', 'app.js'
# Minify CSS
minify 'themes/obsidian.css', 'styles/theme.min.css'
# Concat & minify
bundle '*.js', 'everything.min.js'
Compile, Pre-process, Lint & Minify
Flour packs it's own adapters for the most popular tools. The compile
and minify
methods can detect file types and choose the appropriate compiler, so you don't need to memorize a dozen different methods.
task 'build', ->
compile 'layout.styl', 'layout.css' # Stylus
compile 'layout.less', 'layout.css' # LESS
compile 'layout.*', 'layout.css' # either!
task 'minify', ->
minify 'styles/*.css', 'build/styles/*'
minify 'scripts/*.js', 'build/scripts/*'
task 'lint', ->
lint 'sources/*.js'
Everything at once
bundle()
does all the magic - it compiles, minifies and concatenates whatever you throw at it.
Every method in flour can take a single file path, an array of files or a glob pattern (using node-glob).
task 'build:vendor', ->
bundle [
'vendor/underscore.js'
'vendor/zepto.js'
'vendor/backbone.js'
], 'build/vendor.js'
task 'build:source', ->
bundle [
'sources/bootstrap.coffee'
'sources/app.coffee'
'sources/views/*.coffee'
], 'build/app.js'
Easy file watching
No dependency detection wizardry - you are in control. Watch files, directories or glob patterns, group and invoke your tasks of choice.
task 'watch', ->
watch 'sources/*.js', -> invoke 'build:source'
watch 'styles/*', -> invoke 'build:styles'
watch [
'content/**/*.html'
'views/*'
], -> invoke 'build:templates'