@@ -12,7 +12,7 @@ def calc_parser_flags(
1212 deep_selector_combinator : bool = False
1313) -> ParserFlags :
1414 """
15- Calculates the `parser_flags` argument of `process_stylesheet()`.
15+ Calculates the `parser_flags` argument of `process_stylesheet()` and `bundle_css()` .
1616 """
1717
1818def process_stylesheet (
@@ -42,7 +42,40 @@ def process_stylesheet(
4242 :param browsers_list: An optional list of browserslist targets to be used
4343 to determine automatic prefixing and transpilation. If it is not
4444 specified, no prefixing/transpilation will occur.
45- :param minify: Is True, the final output will be minified. Otherwise, it
45+ :param minify: If True, the final output will be minified. Otherwise, it
4646 will be pretty-printed.
4747 :return: A string containing a processed CSS stylesheet.
4848 """
49+
50+ def bundle_css (
51+ path : str ,
52+ / ,
53+ error_recovery : bool = False ,
54+ parser_flags : ParserFlags = ParserFlags (0 ),
55+ unused_symbols : set [str ] | None = None ,
56+ browsers_list : list [str ] | None = None ,
57+ minify : bool = True
58+ ) -> str :
59+ """
60+ Processes the supplied CSS stylesheet file and returns the bundle as a string.
61+
62+ Resolves all `@import` rules to create a single CSS bundle. The resources
63+ referenced via `@import` are resolved relative to the main file.
64+
65+ :param path: A string containing the path of the stylesheet file to process.
66+ :param error_recovery: Whether or not to omit broken CSS rather than
67+ producing a parse error. Enable with caution!
68+ :param parser_flags: An optional flag created by `calc_parser_flags()`.
69+ See that function for more details.
70+ :param unused_symbols: An optional set of known unused symbols, like
71+ classnames, ids, or keyframe names, to be removed from the output.
72+ Note that symbols should be specified in bare form, i.e.
73+ `unused_symbols={'a', 'b'}`, not `unused_symbols={'.a', '#b'}`, and
74+ will remove both ids and classes if they share a name. Use with caution!
75+ :param browsers_list: An optional list of browserslist targets to be used
76+ to determine automatic prefixing and transpilation. If it is not
77+ specified, no prefixing/transpilation will occur.
78+ :param minify: If True, the final output will be minified. Otherwise, it
79+ will be pretty-printed.
80+ :return: A string containing the CSS bundle.
81+ """
0 commit comments