Constructor
new PrintMedia(chunker, polisher, caller)
Creates an instance of PrintMedia handler.
Creates an instance of PrintMedia handler.
Parameters:
Name | Type | Description |
---|---|---|
chunker |
Object | The chunker instance used for pagination. |
polisher |
Object | The polisher instance that processes stylesheets. |
caller |
Object | The object that coordinates multiple handlers. |
Methods
getMediaName(node) → {Array.<string>}
Extracts all media type names from a @media
at-rule node.
Extracts all media type names from a @media
at-rule node.
Parameters:
Name | Type | Description |
---|---|---|
node |
Object | The AST node representing a |
Returns:
An array of media query identifiers (e.g. ["print"]
, ["screen"]
).
- Type
- Array.<string>
onAtMedia(node, item, list)
Called when a @media
at-rule is encountered in the stylesheet.
Called when a @media
at-rule is encountered in the stylesheet.
- If the media type includes
print
, the rules inside are extracted and appended to the main rule list (i.e. made global). - If the media type is unsupported or not needed, the block is removed entirely.
Parameters:
Name | Type | Description |
---|---|---|
node |
Object | The AST node for the |
item |
Object | The item in the list representing this rule. |
list |
Object | The list of all CSS rules being parsed. |