NAME

CSS::Object::Parser::Default - CSS Object Oriented Default Parser

SYNOPSIS

use CSS::Object;
my $css = CSS::Object->new(
    parser => 'CSS::Object::Parser::Default',
    format => $format_object,
    debug => 3,
) || die( CSS::Object->error );
$css->read( '/my/file.css' ) || die( $css->error );

VERSION

v0.1.0

DESCRIPTION

CSS::Object::Parser::Default is a simple lightweight css parser.

CONSTRUCTOR

new

To instantiate a new CSS::Object::Parser::Default object, pass an hash reference of following parameters:

debug

This is an integer. The bigger it is and the more verbose is the output.

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_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.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

CSS::Object

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.