Rust library to generate static websites
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: some more cleanup

+30 -17
+9
crates/maudit/src/assets/prefetch.rs
··· 6 6 pub const PREFETCH_VIEWPORT_PATH: &str = 7 7 concat!(env!("CARGO_MANIFEST_DIR"), "/js/prefetch/viewport.ts"); 8 8 9 + // Built paths, we don't use any of those ourselves but they can be useful if someone wants to have a bundler-less Maudit 10 + pub const PREFETCH_BUILT_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/js/dist/prefetch.js"); 11 + pub const PREFETCH_HOVER_BUILT_PATH: &str = 12 + concat!(env!("CARGO_MANIFEST_DIR"), "/js/dist/prefetch/hover.js"); 13 + pub const PREFETCH_TAP_BUILT_PATH: &str = 14 + concat!(env!("CARGO_MANIFEST_DIR"), "/js/dist/prefetch/tap.js"); 15 + pub const PREFETCH_VIEWPORT_BUILT_PATH: &str = 16 + concat!(env!("CARGO_MANIFEST_DIR"), "/js/dist/prefetch/viewport.js"); 17 + 9 18 /// Rolldown plugin to handle the maudit:prefetch specifier. 10 19 /// Importing the actual prefetch.ts file from Maudit's crate is very cumbersome in JS, and TypeScript anyway won't enjoy finding the types there 11 20 /// As such, this plugin resolves the maudit:prefetch specifier to the actual file path of prefetch.ts in the Maudit crate for the user.
+21 -17
crates/maudit/src/build.rs
··· 11 11 use crate::{ 12 12 BuildOptions, BuildOutput, 13 13 assets::{ 14 - self, HashAssetType, HashConfig, RouteAssets, Script, TailwindPlugin, calculate_hash, 15 - image_cache::ImageCache, prefetch, 14 + self, HashAssetType, HashConfig, PrefetchPlugin, RouteAssets, Script, TailwindPlugin, 15 + calculate_hash, image_cache::ImageCache, prefetch, 16 16 }, 17 17 build::{images::process_image, options::PrefetchStrategy}, 18 18 content::ContentSources, ··· 420 420 fs::create_dir_all(&route_assets_options.output_assets_dir)?; 421 421 } 422 422 423 - if true { 423 + if !build_pages_styles.is_empty() || !build_pages_scripts.is_empty() { 424 424 let assets_start = Instant::now(); 425 425 print_title("generating assets"); 426 426 ··· 453 453 .chain(css_inputs.into_iter()) 454 454 .collect::<Vec<InputItem>>(); 455 455 456 - println!( 456 + debug!( 457 + target: "bundling", 457 458 "Bundler inputs: {:?}", 458 459 bundler_inputs 459 460 .iter() ··· 479 480 module_types: Some(module_types_hashmap), 480 481 ..Default::default() 481 482 }, 482 - vec![Arc::new(TailwindPlugin { 483 - tailwind_path: options.assets.tailwind_binary_path.clone(), 484 - tailwind_entries: build_pages_styles 485 - .iter() 486 - .filter_map(|style| { 487 - if style.tailwind { 488 - Some(style.path().clone()) 489 - } else { 490 - None 491 - } 492 - }) 493 - .collect::<Vec<PathBuf>>(), 494 - })], 483 + vec![ 484 + Arc::new(TailwindPlugin { 485 + tailwind_path: options.assets.tailwind_binary_path.clone(), 486 + tailwind_entries: build_pages_styles 487 + .iter() 488 + .filter_map(|style| { 489 + if style.tailwind { 490 + Some(style.path().clone()) 491 + } else { 492 + None 493 + } 494 + }) 495 + .collect::<Vec<PathBuf>>(), 496 + }), 497 + Arc::new(PrefetchPlugin {}), 498 + ], 495 499 )?; 496 500 497 501 let _result = bundler.write().await?;