Hashless assets (#4312)
* add support for external assets * fix playwright tests * add more documentation to with_hash_suffix * restore external asset hashing tests * Update gtk workflow dependencies * fix doc test * multiple versions of libgtk * clear dx in playwright tests * fix fullstack caching test * try without apt cache * cache everything except libxdo-dev * revert ci changes * fix wasm asset options * fix merge conflict * recommend the used attribute instead * Move options to AssetOptionsBuilder * Don't deprecate non-canonical new asset options functions --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
0bd376b873
commit
e74c838441
22 files changed
+569
-316
No files matched your search
@@ -21,9 +21,9 @@ pub const PNG_ASSET: Asset =
|
||||
asset!("/assets/image.png");
|
||||
// Resize the image at compile time to make the assets smaller
|
||||
pub const RESIZED_PNG_ASSET: Asset =
|
||||
asset!("/assets/image.png", ImageAssetOptions::new().with_size(ImageSize::Manual { width: 52, height: 52 }));
|
||||
asset!("/assets/image.png", AssetOptions::image().with_size(ImageSize::Manual { width: 52, height: 52 }));
|
||||
// Or convert the image at compile time to a web friendly format
|
||||
pub const AVIF_ASSET: Asset = asset!("/assets/image.png", ImageAssetOptions::new().with_format(ImageFormat::Avif));
|
||||
pub const AVIF_ASSET: Asset = asset!("/assets/image.png", AssetOptions::image().with_format(ImageFormat::Avif));
|
||||
```
|
||||
|
||||
## Adding Support to Your CLI
|
||||
|
||||
@@ -9,6 +9,6 @@ pub use manganis_macro::asset;
|
||||
pub use manganis_macro::css_module;
|
||||
|
||||
pub use manganis_core::{
|
||||
Asset, AssetOptions, BundledAsset, CssAssetOptions, CssModuleAssetOptions, FolderAssetOptions,
|
||||
ImageAssetOptions, ImageFormat, ImageSize, JsAssetOptions,
|
||||
Asset, AssetOptions, AssetVariant, BundledAsset, CssAssetOptions, CssModuleAssetOptions,
|
||||
FolderAssetOptions, ImageAssetOptions, ImageFormat, ImageSize, JsAssetOptions,
|
||||
};
|
||||
@@ -1,13 +1,12 @@
|
||||
pub use const_serialize;
|
||||
use const_serialize::{serialize_const, ConstStr, ConstVec, SerializeConst};
|
||||
use const_serialize::{serialize_const, ConstVec, SerializeConst};
|
||||
use manganis_core::{AssetOptions, BundledAsset};
|
||||
|
||||
const PLACEHOLDER_HASH: ConstStr =
|
||||
ConstStr::new("this is a placeholder path which will be replaced by the linker");
|
||||
const PLACEHOLDER_HASH: &str = "this is a placeholder path which will be replaced by the linker";
|
||||
|
||||
/// Create a bundled asset from the input path, the content hash, and the asset options
|
||||
pub const fn create_bundled_asset(input_path: &str, asset_config: AssetOptions) -> BundledAsset {
|
||||
BundledAsset::new_from_const(ConstStr::new(input_path), PLACEHOLDER_HASH, asset_config)
|
||||
BundledAsset::new(input_path, PLACEHOLDER_HASH, asset_config)
|
||||
}
|
||||
|
||||
/// Create a bundled asset from the input path, the content hash, and the asset options with a relative asset deprecation warning
|
||||
|
||||
Reference in new issue
Block a user