pub struct HTMLMinifier { /* private fields */ }Expand description
This struct helps you generate and minify your HTML code in the same time. The output destination is inside this struct.
Implementations§
Source§impl HTMLMinifier
impl HTMLMinifier
Source§impl HTMLMinifier
impl HTMLMinifier
Sourcepub fn set_remove_comments(&mut self, remove_comments: bool)
pub fn set_remove_comments(&mut self, remove_comments: bool)
Set whether to remove HTML comments. Empty comments are kept when needed to keep text from forming a different character reference or tag.
Sourcepub fn set_minify_code(&mut self, minify_code: bool)
pub fn set_minify_code(&mut self, minify_code: bool)
Set whether to minify the content in the code element.
Sourcepub fn set_minify_js(&mut self, minify_js: bool)
pub fn set_minify_js(&mut self, minify_js: bool)
Set whether to minify JavaScript in supported script elements.
Sourcepub fn set_minify_css(&mut self, minify_css: bool)
pub fn set_minify_css(&mut self, minify_css: bool)
Set whether to minify CSS in supported style elements.
Sourcepub const fn get_remove_comments(&self) -> bool
pub const fn get_remove_comments(&self) -> bool
Get whether to remove HTML comments.
Sourcepub const fn get_minify_code(&self) -> bool
pub const fn get_minify_code(&self) -> bool
Get whether to minify the content in the code element.
Sourcepub const fn get_minify_js(&self) -> bool
pub const fn get_minify_js(&self) -> bool
Get whether to minify JavaScript in supported script elements.
Sourcepub const fn get_minify_css(&self) -> bool
pub const fn get_minify_css(&self) -> bool
Get whether to minify CSS in supported style elements.
Source§impl HTMLMinifier
impl HTMLMinifier
Source§impl HTMLMinifier
impl HTMLMinifier
Sourcepub fn digest<S: AsRef<[u8]>>(
&mut self,
text: S,
) -> Result<(), HTMLMinifierError>
pub fn digest<S: AsRef<[u8]>>( &mut self, text: S, ) -> Result<(), HTMLMinifierError>
Input some text to generate HTML code. It is not necessary to input a full HTML text at once.
Sourcepub fn finish(&mut self) -> Result<(), HTMLMinifierError>
pub fn finish(&mut self) -> Result<(), HTMLMinifierError>
Finish the current input and report any incomplete tag or special element.
Sourcepub unsafe fn indigest<S: AsRef<[u8]>>(&mut self, text: S)
pub unsafe fn indigest<S: AsRef<[u8]>>(&mut self, text: S)
Directly input some text to generate HTML code. The text will just be appended to the output buffer instead of being through the helper.
§When to Use This?
If the text has been minified, you can consider to use this method to get a better performance.