Struct minify_html::Cfg

source ·
pub struct Cfg {
Show 13 fields pub do_not_minify_doctype: bool, pub ensure_spec_compliant_unquoted_attribute_values: bool, pub keep_closing_tags: bool, pub keep_html_and_head_opening_tags: bool, pub keep_spaces_between_attributes: bool, pub keep_comments: bool, pub minify_css: bool, pub minify_css_level_1: bool, pub minify_css_level_2: bool, pub minify_css_level_3: bool, pub minify_js: bool, pub remove_bangs: bool, pub remove_processing_instructions: bool,
}
Expand description

Configuration settings that can be adjusted and passed to a minification function to change the minification approach.

Fields§

§do_not_minify_doctype: bool

Do not minify DOCTYPEs. Minified DOCTYPEs may not be spec compliant.

§ensure_spec_compliant_unquoted_attribute_values: bool

Ensure all unquoted attribute values in the output do not contain any characters prohibited by the WHATWG specification.

§keep_closing_tags: bool

Do not omit closing tags when possible.

§keep_html_and_head_opening_tags: bool

Do not omit <html> and <head> opening tags when they don’t have attributes.

§keep_spaces_between_attributes: bool

Keep spaces between attributes when possible to conform to HTML standards.

§keep_comments: bool

Keep all comments.

§minify_css: bool

Minify CSS in <style> tags and style attributes using https://github.com/Mnwa/css-minify. By default, the optimisation level is 1 as specified by the CSS minifier, but this can be adjusted by the minify_css_level_* settings.

§minify_css_level_1: bool

Use optimisation level 1 for the CSS minifier. This is currently the default, but may change in the future if higher levels become safe.

§minify_css_level_2: bool

Use optimisation level 2 for the CSS minifier. This is mostly safe, but may perform some dangerous optimisations.

§minify_css_level_3: bool

Use optimisation level 3 for the CSS minifier. This performs many dangerous optimisations, so ensure any input works with this level.

§minify_js: bool

Minify JavaScript in <script> tags using minify-js.

Only <script> tags with a valid or no MIME type is considered to contain JavaScript, as per the specification.

§remove_bangs: bool

Remove all bangs.

§remove_processing_instructions: bool

Remove all processing_instructions.

Implementations§

source§

impl Cfg

source

pub fn new() -> Cfg

source

pub fn spec_compliant() -> Cfg

Trait Implementations§

source§

impl Default for Cfg

source§

fn default() -> Cfg

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Cfg

§

impl Send for Cfg

§

impl Sync for Cfg

§

impl Unpin for Cfg

§

impl UnwindSafe for Cfg

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.