-
Notifications
You must be signed in to change notification settings - Fork 9
Blocks
Replacement blocks (blocks) are regions in a source file that will be updated by the task. Blocks must be configured in the source file and in the Grunfile.js configuration for the task. Comments are placed in the source file to define anchors that mark the beginning and end of the block. Two comment styles are supported for HTML and JavaScript/TypeScript files.
fileblock:<template> <name>
template: This must match the name of a custom template or one of the supplied templates js, css, ref, or raw.
endfileblock
<!-- fileblock:js appScripts -->
<!-- endfileblock -->
/* fileblock:ref references */
/* endfileblock */
Each source file in the Gruntfile configuration defines a blocks array. Each element in this array is a block configuration object.
fileblocks: {
my_target: {
src: 'index.html'
blocks: {
'scripts': { src: 'app/js/*.js' /* Optional block level options */}
/*... additional block configurations */
}
}
}
Type: String|String[]
File globbing patterns used to find source files.
Type: String
The name of the template for the block. This property overrides the template name specified in the start anchor.
Any of the task options may be specified at the block level.
The cwd, flatten, ext, rename, and matchBase options may be added to a block configuration object in order to build the files list dynamically.