v4 ideas
See original GitHub issue- Maybe get rid of the TransformQueue, just call each transform separately and
await
- Allow transforms to fulfill with at custom value (don’t force it to be the AssetGraph instance)
- Plugin API: .use(…) with a function that can install assets, relations, and named transforms.
- Consider an explicit
Async
suffix for async transforms? Could be enforced: “Error: You returned a promise from a transform whose name isn’t suffixed with Async” - Should plugins be installed per AssetGraph instance or globally? (I think I’d prefer the former)
- Consider an explicit
- Pluggable relations via asset-specific visitor functions
- Spike: Make
parseTree
,text
,rawSrc
async again - New query syntax? Maybe try out https://github.com/crcn/sift.js (https://github.com/assetgraph/assetgraph/pull/814)
Follow-up 2017-12-30
TransformQueue
Agreement on dropping TransformQueue. The reason we were clinging to the idea of it was a potential instrumentation hook that could somehow discover graph access and record it in order to cache the transform step and skip it in an incremental rebuild style application. Since we have very few ideas on how to actually do this we’re in agreement that if we ever figure it out, we’ll cut a new major version which might introduce something similar to TransformQueue, but as an opt-in extra wrapper around transform calls.
TransformQueue is out. Transforms will be called with await resultingGraph = transformName(assetGraph, queryObject?, options);
Possible future api’s that were discussed, but not agreed on yet:
const minifyCss = require('assetgraph-minifyCss');
await minifyCss(assetGraph, {
assetsQuery: {
type: 'Css',
isInline: false
},
mergeLonghand: false
});
await minifyCss(assetGraph.findAssets({ type: 'Css', isInline: false }, { mergeLonghand: false });
await assetGraph.transform({ type: 'Css', isInline: false }, minifyCss({
mergeLonghand: false
}));
await assetGraph.transform(minifyCss({
mergeLonghand: false
}), { type: 'Css', isInline: false});
await assetGraph.transform(minifyCss());
await minifyCss({ mergeLonghand: false })(assetGraph, optionalQuery);
await minifyCss({ mergeLonghand: false })(assetGraph);
sift.js
The current spike on a sift implementation seems to work, but has a hack for being able to query by identity and a hack for querying by regex with the same syntax that we had in AssetGraph.query
. We want to remove the hack for regex querying and have things use the sift syntax: {$regex: /foo/}
. The need for regex queries will be greatly reduced when #817 and #818 are implemented
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top GitHub Comments
@papandreou I use
.njk
as a file extension for them, but I believe.nunjucks
and even.html
is sometimes used by other people. I would pretty much just like to resolve the images, stylesheets, and scripts in the HTML portions, the actual templating could probably be handled by the Nunjucks compiler itself, I think.@devmattrick Can the nunchucks files distinguished from regular .html files based on a file extension or something similar?
… And I assume that what you want to accomplish is to discover the relations in the pure HTML parts of the nunchucks files?