-
Notifications
You must be signed in to change notification settings - Fork 55
mkdirs
The mkdirs task is working in tandem with the clean one, and creates the necessary build dirs.
// the staging directory used during the process
staging: 'intermediate/',
// final build output
output: 'publish/',
// filter any files matching one of the below pattern during mkdirs task
exclude: 'build/** node_modules/** grunt.js package.json *.md'.split(' '),
mkdirs: {
staging: '<config:exclude>',
output: '<config:exclude>'
},
Just as the clean task, config subprop are used to create the
directories. A basic mapping is done in configuration to get back the
directory values, (eg. config(task.target) --> config('staging')
).
Values for each is an array of files to filter, eg. they'll not be copied over during the process. These are minimatch patterns.
mkdir
helper is basic wrapper around
node-mkdirp. Takes a
directory
path to create, process is async if a valid callback
is passed in, otherwise sync process.
task.helper('mkdir', dir, cb);
copy
helper uses ncp
and minimatch to copy
the files under the current directory to the specified dir
,
optionnaly ignoring files specified by the options.ignore
property.
options.ignore
can be a String of space delimited glob patterns,
an Array of glob patterns, or a filter function.
This helper is asynchronous only. Paths are always relative to current working directory.
- source - Path to the source directory
- dest - where the files will be copied to
- opts - (optional) An Hash object with an
ignore
property - cb - callback to call on completion
task.helper('copy', source, dest, opts, function(e) {
if(e) log.error(e.stack || e.message);
else log.ok();
cb(!e);
});
» Home
» Tasks
» clean: Wipe the previous build dirs.
» mkdirs: Prepares the build dirs.
» concat: Concatenate files. (built-in)
» css: Concats, replaces @imports and minifies CSS files.
» min: Minify files using UglifyJS (built-in)
» rev: Automate the revving of assets and perform the hash rename
» usemin: Replaces references to non-minified scripts / stylesheets
» serve: Spawns up a basic local http server
» connect: livereload version of serve task