NAME
CSS::Object::Parser::Enhanced - CSS Object Oriented Enhanced Parser
SYNOPSIS
use
CSS::Object;
my
$css
= CSS::Object->new(
parser
=>
'CSS::Object::Parser::Enhanced'
,
format
=>
$format_object
,
debug
=> 3,
) ||
die
( CSS::Object->error );
$css
->
read
(
'/my/file.css'
) ||
die
(
$css
->error );
VERSION
v0.2.0
DESCRIPTION
CSS::Object::Parser::Enhanced is a lightweight, but thorough css parser. It aims at being very reliable and fast. The elements parsed are stored in a way so they can be stringified to produce a css stylesheet very close to the one that was parsed.
CONSTRUCTOR
new
To instantiate a new CSS::Object::Parser::Enhanced object, pass an hash reference of following parameters:
METHODS
add_rule
It takes 2 parameters: string of selectors and the rule content, i.e. inside the curly braces.
It creates a new CSS::Object::Rule object, adds to it a new CSS::Object::Selector object for each selector found and also add a new CSS::Object::Property object for each property found.
It returns the rule object created.
parse_element
Provided with a set of parameters as an hash reference and this parse the element and returns a hash reference with 2 properties: rule which is a CSS::Object::Rule object and pos which is an integer representing the position of the pointer in the parsed string.
parse_string
Provided with some css text data and this will parse it and return an array object of CSS::Object::Rule objects. The array returned is an Module::Generic::Array object.
It does this by calling "add_rule" on each rule found in the css data provided.
Each CSS::Object::Rule object containing one more more CSS::Object::Selector objects and one or more CSS::Object::Property objects.
rule_from_token
Provided with a css token and this returns an adequate rule object. CSS token can be a css selector, or an at rule
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
COPYRIGHT & LICENSE
Copyright (c) 2020 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.