Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/artushak/artushak-web-assets
Web asset manager
https://github.com/artushak/artushak-web-assets
asset-management rust web-assets
Last synced: 6 days ago
JSON representation
Web asset manager
- Host: GitHub
- URL: https://github.com/artushak/artushak-web-assets
- Owner: ArtUshak
- License: apache-2.0
- Created: 2021-08-30T18:41:29.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T10:19:24.000Z (5 months ago)
- Last Synced: 2024-10-30T02:37:48.684Z (about 2 months ago)
- Topics: asset-management, rust, web-assets
- Language: Rust
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `artushak-web-assets`
This is a simple web asset manager. It can manage an asset manifest and generate new file version when a source file or asset manifest is changed. It can be useful in web to allow far future cache expiry headers.
For example, you may have SASS file and a correct manifest. If this file is updated and you run `pack` function, your file will be processed by filter and copied to output directory with new name.
## Asset manifest format
Asset manifest is a JSON dictionary with fields:
* `public_assets` is list of names of assets that should be copied to output directory, each list item is string
* `assets` is a list of asset definitions, each list item is a dictionary with keys:
* `output_base_path` (optional), value is a prefix of output path (string)
* `extension`, value is file extension (string)
* `source`, value is file source data, a dictionary with either of keys:
* `File` (if asset is loaded from a source file), value is a file path
* `Filtered` (if asset is generated by filter), value is a dictionary with keys:
* `filter_name`, value is a filter name (using filter registry)
* `input_names`, value is a list of input asset names
* `options`, value is dictionary with arbitary string keys with values passed to filter as options, possible values can be:
* `"Flag"` is flag option
* `{"String": "STRING"}` is string option (place value instead of `STRING`)
* `{"StringVec": ["STRING1", "STRING2"]}` is string list option (place values instead of `STRING1`, `STRING`, etc)
* `{"Bool": false}` is false boolean option
* `{"Bool": true}` is true boolean option### Example
```json
{
"assets": {
"style_sass": {
"extension": "sass",
"source": {
"File": "style.sass"
}
},
"style_css": {
"extension": "css",
"source": {
"Filtered": {
"filter_name": "SASS",
"input_names": [
"style_sass"
],
"options": {
"mode": {
"String": "Compressed"
}
}
}
}
},
"icon1_svg": {
"output_base_path": "images",
"extension": "svg",
"source": {
"File": "icon1.svg"
}
}
},
"public_assets": [
"style_css",
"icon1_svg"
]
}
```## Asset filters
Asset filters are implementations of `AssetFilter` trait. They take list of input file paths and file path output. For example, asset filter can compile SASS, minify file content and so on. Filters also take dictionary of options from manifest.