Since I was so clear about what I was looking for here and I could not find it, I really went ahead and wrote my first node module with the accompanying Grunt task grunt-inline-web-components.
The configuration allows you to specify a jQuery style selector and paths to the template files that should be embedded in any matching nodes. This is a basic concept, but powerful enough. For example, if I give components, I want to โprecompileโ the class critical, then I can embed them in several separate places. Here is some code to illustrate:
grunt.initConfig({
inline_web_components: {
options: {
components: {
"about-app": "components/about-app.html",
"my-component:first": "components/my-component.html",
"flashy-button.critical": "components/flashy-button.html"
}
},
dist: {
dist: {
files: [
expand: true,
cwd: "app",
src: "{,*/}*.html",
dest: "dist"
]
}
},
},
});
source
share