This processor is a base processor put in front of most asset processing. It is responsible for parsing directives like '//=require file' or '//=require_tree .' or '//=require_self'. It is capable of creating a dependency graph of all files needed to be bundled together from these directives. Duplicate requires are ignored.
Type | Name and description |
---|---|
static def |
DIRECTIVES References names of directives to implemented methods. |
ClassLoader |
classLoader |
Constructor and description |
---|
DirectiveProcessor
(String contentType, AssetCompiler precompiler = null, ClassLoader classLoader = Thread.currentThread() |
Type | Name and description |
---|---|
void |
callDirective(String name, String[] directiveArguments, AssetFile fileSpec, Map tree) |
def |
compile(AssetFile file) Takes an AssetFile and compiles it to a final result based on input directives and setup Processors. |
String[] |
directiveArgumentsFromGString(String directive) |
def |
encodingTypeDirective(def command, def fileSpec, def tree) Set your file encoding within your manifest |
String |
fileContents(AssetFile file) Used for fetching the contents of a file be it a Generic unprocessable entity or an AssetFile with a processable stream |
protected def |
findDirectives(AssetFile fileSpec, Map tree) Scans an AssetFile for directive patterns and builds a dependency tree |
protected Map |
getDependencyTree(AssetFile file) Builds a dependency tree for a particular file |
def |
getFlattenedRequireList(def file) Returns a Flattened list of files based on the require tree This is useful for converting a script tag into several script tags for debugging |
protected boolean |
isFileInTree(AssetFile file) Checks if a file reference is already in the dependency graph |
protected void |
loadContentsForTree(Map treeSet, StringBuilder buffer) Scans through a generated tree and builds a files contents recursively |
protected def |
loadRequiresForTree(def treeSet, def flattenedList) Scans through a generated tree and builds a flatted list of requirements recursively |
def |
requireFileDirective(def command, def file, def tree) Directive which allows inclusion of individual files Example: //=require sample.js |
def |
requireFullTreeDirective(def command, def fileSpec, def tree) Loads files recursively within the specified relative path across ALL resolvers Example: //=require_full_tree /spud/admin |
def |
requireSelfDirective(def command, def file, def tree) Used to control file order for when content within your manifest exists |
def |
requireTreeDirective(def command, def fileSpec, def tree) Loads files recursively within the specified folder within the same source resolver Example: //=require_tree . |
References names of directives to implemented methods. This can be adjusted at run time to either override behavior or add custom directives
Takes an AssetFile and compiles it to a final result based on input directives and setup Processors. If a GenericAssetFile is passed in the raw byte array is returned.
file
- an instance of an AbstractAssetFile (i.e. JsAssetFile or CssAssetFile)Set your file encoding within your manifest
Used for fetching the contents of a file be it a Generic unprocessable entity or an AssetFile with a processable stream
Scans an AssetFile for directive patterns and builds a dependency tree
fileSpec
- The assetFile we wish to scantree
- The tree object we use to build the graph (should be a List)Builds a dependency tree for a particular file
Returns a Flattened list of files based on the require tree This is useful for converting a script tag into several script tags for debugging
file
- an instance of an AbstractAssetFile (i.e. JsAssetFile or CssAssetFile)Checks if a file reference is already in the dependency graph
file
- The file being checked for within the dependency graphScans through a generated tree and builds a files contents recursively
Scans through a generated tree and builds a flatted list of requirements recursively
Directive which allows inclusion of individual files Example: //=require sample.js
Loads files recursively within the specified relative path across ALL resolvers Example: //=require_full_tree /spud/admin
Used to control file order for when content within your manifest exists
Groovy Documentation