-
Couldn't load subscription status.
- Fork 20
API reference
Returns a node object representing the contents of the 'foo' directory.
Returns the result of merging the input nodes. Later files overwrite earlier ones.
Returns a tree that is the result of applying transformer to node1. The transformer function takes five arguments - inputDir, outputDir, options, callback and errback:
-
inputDir- the folder to read files from -
outputDir- the folder to write files to -
options- the options passed into thetransformmethod (or{}, if none) -
callback- a function that you must call once you've finished writing files -
errback- if an error occurs, callerrback(error)
Asynchronous operations are preferred. gobble.file contains a bunch of useful filesystem helpers that return promises, which help deal with node callback hell. (Docs coming soon!)
Sometimes it's useful, for debugging purposes, to dump part of your build to disk in order to inspect it. This method will continuously write the contents of node to 'tmp-some-dir' whenever they change, as long as Gobble is running. It returns this, so it doesn't affect the build in any way - it's just a convenient way to see what's going on.
There are a handful of built-in transforms:
Filters out any files that don't match patterns. patterns can be a minimatch string, or an array of them.
Opposite of node.include(patterns).
For one-to-one replacements (e.g. transpiling coffeescript). fn is a function that takes two arguments - content and options, where content is the contents of the file to process, and options is the options argument passed into map. The function must return the replacement content.