rusty_handlebars_parser/
build_helper.rs

1//! HTML minification configuration
2//!
3//! This module provides configuration for HTML minification when the `minify-html` feature
4//! is enabled. It uses the `minify-html` crate to optimize HTML output while preserving
5//! template syntax.
6
7use minify_html::Cfg;
8
9/// Configuration for HTML minification
10///
11/// This configuration is used when the `minify-html` feature is enabled to optimize
12/// HTML output. It's designed to:
13///
14/// - Preserve Handlebars template syntax
15/// - Maintain HTML validity
16/// - Optimize JavaScript and CSS
17/// - Keep essential HTML structure
18#[cfg(feature = "minify-html")]
19pub static COMPRESS_CONFIG: Cfg = Cfg {
20    // Minify JavaScript in script tags
21    minify_js: true,
22    // Minify CSS in style tags
23    minify_css: true,
24    // Preserve doctype declarations
25    do_not_minify_doctype: true,
26    // Ensure attribute values are spec-compliant
27    ensure_spec_compliant_unquoted_attribute_values: true,
28    // Keep closing tags for elements that require them
29    keep_closing_tags: true,
30    // Preserve html and head opening tags
31    keep_html_and_head_opening_tags: true,
32    // Maintain spaces between attributes
33    keep_spaces_between_attributes: true,
34    // Remove HTML comments
35    keep_comments: false,
36    // Remove type="text" from input elements
37    keep_input_type_text_attr: false,
38    // Remove SSI comments
39    keep_ssi_comments: false,
40    // Preserve Handlebars template syntax
41    preserve_brace_template_syntax: true,
42    // Remove ASP-style template syntax
43    preserve_chevron_percent_template_syntax: false,
44    // Remove HTML comments
45    remove_bangs: false,
46    // Remove XML processing instructions
47    remove_processing_instructions: false
48};