Addon developers want to make optimizations in which the analysis of one tree (p.e, templates
or js
trees, or both) enables
optimizations on other trees (p.e. styles
or public
).]
Right now ember-cli exposes preprocessTree(type, tree)
and postprocessTree(type, tree)
, but they don't work for this
purpose because
-
The
preprocessTree
receives the individual tree types (app
,styles
,templates
,test-support
,public
...), but there is no single three that gives the developers access to all those types simultaneously to perform cross-type operations. -
The
postprocessTree
does receive a tree namedall
that gives access to the final result of the build, but by then the processing has finished (sass
have been compiled tocss
already, images have been concatenated into sprites, etc...), so it's too late for the user to do some transforms.
Pass a tree named all
to the preprocessTree
hook like the postprocess tree already does, so users have access to the raw
files before it's too late.
It is important that this tree is generated including the trees coming from addons, as the operation the developer wants to perform might also care about those.
In an addon I'm developing I also needed access to the
all
tree in thepreprocessTree
hook, so I'm using this:this.app.trees.app
to access it, but it might be the wrong way of doing it.