pub struct JsMinifier;Expand description
A very simple JavaScript minifier that removes comments and collapses unnecessary whitespace. Not a full minifier, but reduces output size.
Implementations§
Source§impl JsMinifier
impl JsMinifier
Sourcepub fn minify(source: &str) -> String
pub fn minify(source: &str) -> String
Minify a JS source string.
Operations performed:
- Remove
// ...line comments - Collapse runs of whitespace to a single space
- Remove leading/trailing whitespace per line
Sourcepub fn strip_block_comments(source: &str) -> String
pub fn strip_block_comments(source: &str) -> String
Strip block comments /* ... */ from a JS string.
Auto Trait Implementations§
impl Freeze for JsMinifier
impl RefUnwindSafe for JsMinifier
impl Send for JsMinifier
impl Sync for JsMinifier
impl Unpin for JsMinifier
impl UnsafeUnpin for JsMinifier
impl UnwindSafe for JsMinifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more