Skip to content

Commit

Permalink
Revert "Merge pull request #35 from CloudCannon/feat/minify-files"
Browse files Browse the repository at this point in the history
This reverts commit 7750a5d, reversing
changes made to aa2fd31.
  • Loading branch information
bglw committed Jul 26, 2022
1 parent 7750a5d commit d9a973b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pagefind/src/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::SearchOptions;
use flate2::write::GzEncoder;
use flate2::Compression;
use futures::future::join_all;
use minifier::{css, js};
use minifier::js::minify;
use tokio::fs::{create_dir_all, File};
use tokio::io::AsyncWriteExt;
use tokio::time::sleep;
Expand All @@ -22,12 +22,12 @@ const WEB_JS: &str = include_str!(concat!(
env!("CARGO_PKG_VERSION"),
".js"
));
const WEB_UI_JS: &str = include_str!(concat!(
const WEB_UI_JS: &[u8] = include_bytes!(concat!(
"../../vendor/pagefind_ui.",
env!("CARGO_PKG_VERSION"),
".js"
));
const WEB_UI_CSS: &str = include_str!(concat!(
const WEB_UI_CSS: &[u8] = include_bytes!(concat!(
"../../vendor/pagefind_ui.",
env!("CARGO_PKG_VERSION"),
".css"
Expand All @@ -39,9 +39,7 @@ impl PagefindIndexes {
pub async fn write_files(self, options: &SearchOptions) {
let outdir = options.source.join(&options.bundle_dir);

let js = js::minify(&format!("{}\n{}\n{}", WEB_JS, GUNZIP_JS, SEARCH_JS));
let ui_js = js::minify(WEB_UI_JS);
let ui_css = css::minify(WEB_UI_CSS).expect("Pagefind CSS is invalid");
let js = minify(&format!("{}\n{}\n{}", WEB_JS, GUNZIP_JS, SEARCH_JS));

let mut files = vec![
write(
Expand All @@ -52,13 +50,13 @@ impl PagefindIndexes {
),
write(
outdir.join("pagefind-ui.js"),
vec![ui_js.as_bytes()],
vec![WEB_UI_JS],
Compress::None,
WriteBehavior::None,
),
write(
outdir.join("pagefind-ui.css"),
vec![ui_css.as_bytes()],
vec![WEB_UI_CSS],
Compress::None,
WriteBehavior::None,
),
Expand Down

0 comments on commit d9a973b

Please sign in to comment.