1.0.3
Asset files (eg, text, images) bundle tool for Deno.
Repository
Current version released
4 years ago
Dependencies
Versions
assets-builder
Asset files (eg, text, image) bundle tool for Deno.
Install
deno install --allow-read https://deno.land/x/asset_builder/asset_builder.ts
# Import config file from default ./assets_config.json.
asset_builder >> assets.ts
# Set Import config file.
asset_builder --import-file my_assets_config.json >> assets.ts
Usage
# Import config file from default ./assets_config.json.
deno run --allow-read https://deno.land/x/asset_builder/asset_builder.ts >> assets.ts
# Set Import config file.
deno run --allow-read https://deno.land/x/asset_builder/asset_builder.ts --import-file my_assets_config.json >> assets.ts
Configuration
The configuration file is described in json.
Write as follows.
{
"files":[
{
"importPath": "./sample.txt",
"calledName": "sample-text"
}
]
}
Example of using bundled files
The file created by asset_builder is used as follows.
import assets from './assets.ts'
for (const [key, value] of Object.entries(assets.files)) {
console.log(`key: ${key}, extension: ${value.extension}, content: ${new TextDecoder().decode(value.content) }`);
}
// key: test-text, extension: txt, content: Hello World!!
// key: test-text2, extension: txt, content: Hello World!!