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
@@ -62,7 +62,7 @@ pub(crate) fn hash_file_with_options(
|
||||
hasher: &mut impl Hasher,
|
||||
in_folder: bool,
|
||||
) -> anyhow::Result<()> {
|
||||
let resolved_options = resolve_asset_options(source, options);
|
||||
let resolved_options = resolve_asset_options(source, options.variant());
|
||||
|
||||
match &resolved_options {
|
||||
// Scss and JS can import files during the bundling process. We need to hash
|
||||
@@ -145,8 +145,11 @@ pub fn add_hash_to_asset(asset: &mut BundledAsset) {
|
||||
.map(|byte| format!("{byte:x}"))
|
||||
.collect::<String>();
|
||||
let file_stem = source_path.file_stem().unwrap_or(file_name);
|
||||
let mut bundled_path =
|
||||
PathBuf::from(format!("{}-dxh{hash}", file_stem.to_string_lossy()));
|
||||
let mut bundled_path = if asset.options().hash_suffix() {
|
||||
PathBuf::from(format!("{}-dxh{hash}", file_stem.to_string_lossy()))
|
||||
} else {
|
||||
PathBuf::from(file_stem)
|
||||
};
|
||||
|
||||
if let Some(ext) = ext {
|
||||
bundled_path.set_extension(ext);
|
||||
|
||||
Reference in new issue
Block a user