HTML Asset Manager
Run go-html-asset-manager commands easily from node.
Install
go get -u github.com/gauntface/go-html-asset-manager/cmds/htmlassets/
go get -u github.com/gauntface/go-html-asset-manager/cmds/genimgs/
API
const ham = require('@gauntface/html-asset-manager');
await ham.manageAssets({
config: path.join('~/example-project/asset-manage.json'),
output: true,
vimeo: process.env['VIMEO_TOKEN'],
debug: 'example-file.html',
});
await ham.generateImages({
config: path.join('~/example-project/asset-manage.json'),
output: true,
});
Config File
{
"html-dir": "public/",
"assets": {
"static-dir": "public/",
"generated-dir": "public/generated/",
"json-dir": "data/"
},
"gen-assets": {
"static-dir": "static/",
"output-dir": "static/generated/",
"max-width": 800,
"max-density": 3
},
"img-to-picture": [
{
"id": "l-blog",
"max-width": 800,
"source-sizes": [
"(min-width: 800px) 800px",
"100vw"
]
},
{
"id": "c-blog-item__img",
"max-width": 200,
"source-sizes": [
"(min-width: 800px) 200px",
"20vw"
]
}
],
"ratio-wrapper": ["l-blog"]
}