IgniterCss.CSS.CssProcessor (igniter_css v0.1.0)
View SourceA module that provides higher-level CSS processing functionality by leveraging the CSS.Parser module.
Summary
Functions
Applies browser compatibility fixes to CSS.
Extracts critical CSS by identifying and extracting all styles needed for above-the-fold content.
Merges multiple CSS files into one optimized stylesheet.
Processes a CSS file for production by
Functions
Applies browser compatibility fixes to CSS.
Makes CSS work across browsers by:
- Adding vendor prefixes for properties that need them
- Adding standard fallbacks for newer CSS features
- Adding the .hide-scrollbar modifier as needed
Returns
The CSS with compatibility fixes applied
Extracts critical CSS by identifying and extracting all styles needed for above-the-fold content.
Parameters
css_content
- The full CSS content as a stringcritical_selectors
- List of selectors considered critical for above-the-fold content
Returns
A tuple with {critical_css, non_critical_css}
Merges multiple CSS files into one optimized stylesheet.
Parameters
css_files
- Map of{filename, content}
pairsopts
- Options (same as process_for_production)
Returns
The merged and optimized CSS
Processes a CSS file for production by:
- Adding vendor prefixes for browser compatibility
- Removing duplicate rules
- Sorting properties for better diff comparison
- Minifying the CSS
Parameters
css_content
- The CSS content as a stringopts
- Options for processing::minify
- Whether to minify the output (default:true
):add_prefixes
- Whether to add vendor prefixes (default:true
):sort
- Whether to sort properties (default:true
):remove_duplicates
- Whether to remove duplicates (default:true
)
Returns
The processed CSS as a string