Eyeglass assets are installed for each invocation of asset-url() which can add performance overhead at scale especially when the same asset is installed many times.
ember-cli-eyeglass now intercepts asset installation and records which assets are installed to which locations. It does this by writing all those assets into a single tree for the entire app and all addons and engines after they are built, which it only needs to do once per distinct url. To accomplish this, I wrote a new broccoli-plugin in this commit which makes in possible to symlink arbitrary files into an output tree.
This PR has the benefit of also ensuring that asset urls can be resolved to any path instead of forcing those urls to resolve to a location relative to the current tree, which fixes a long-standing annoyance that forced assets to be duplicated in engines (note: this patch doesn't change the asset installation locations -- a custom resolver is required to accomplish this for now).
This patch was made more tricky because of my bone-headed insistence of having a generic broccoli sass plugin as the base class for the broccoli eyeglass plugin. The pure sass plugin is in charge of the caching strategy so it uses events to delegate knowledge of how additional outputs are restored from cache to the external code that is invoking this plugin and doing weird things with assets outside the output tree.
A few other things to note:
ember-cli-eyeglass addons (and the broccoli eyeglass compiler plugin) have a slightly different annotation now (it will show the parent app as well as the addon/engine name). If there's code that's relying on the annotation names, it may break or cause reporting inconsistencies.
When persistent caching is enabled, it now automatically sets up any addons or engines to use a different persistent cache key instead of requiring each one to set their cache key in the configuration.
The format of the output cache data has changed... as such the cache key for that data has a version which has been incremented to forcibly invalidate all the old caches in the wrong format.
The old handling for non-css assets in ember apps has been removed because this new approach supersedes it.
Eyeglass assets are installed for each invocation of
asset-url()
which can add performance overhead at scale especially when the same asset is installed many times.ember-cli-eyeglass
now intercepts asset installation and records which assets are installed to which locations. It does this by writing all those assets into a single tree for the entire app and all addons and engines after they are built, which it only needs to do once per distinct url. To accomplish this, I wrote a new broccoli-plugin in this commit which makes in possible to symlink arbitrary files into an output tree.This PR has the benefit of also ensuring that asset urls can be resolved to any path instead of forcing those urls to resolve to a location relative to the current tree, which fixes a long-standing annoyance that forced assets to be duplicated in engines (note: this patch doesn't change the asset installation locations -- a custom resolver is required to accomplish this for now).
This patch was made more tricky because of my bone-headed insistence of having a generic broccoli sass plugin as the base class for the broccoli eyeglass plugin. The pure sass plugin is in charge of the caching strategy so it uses events to delegate knowledge of how additional outputs are restored from cache to the external code that is invoking this plugin and doing weird things with assets outside the output tree.
A few other things to note:
TODO: I need to add some additional test cases.