Catalyst::Controller::SimpleCAS::CSS::Simple - Temp copy of CSS::Simple
This is a temp/hack copy of CSS::Simple at version 3211, since version 3220 (latest on CPAN as of the time of this writing) is broken for perl 5.12 and earlier. This was reported in RT#105857 but has not yet been fixed, and this has broken the deptree for RapidApp, which I couldn't leave any longer. I hate doing this but I don't have the bandwidth to track down the author to fix the module. If/when the author fixes the version on CPAN, I will delete this file and go back to using the real version.
8/29/2015 by vanstyn
Instantiates the CSS::Simple object. Sets up class variables that are used during file parsing/processing.
warns_as_errors (optional). Boolean value to indicate whether fatal errors should occur during parse failures.
Opens and reads a CSS file, then subsequently performs the parsing of the CSS file necessary for later manipulation.
This method requires you to pass in a params hash that contains a filename argument. For example:
$self->read_file({filename => 'myfile.css'});
Reads css data and parses it. The intermediate data is stored in class variables.
Compound selectors (i.e. "a, span") are split apart during parsing and stored separately, so the output of any given stylesheet may not match the output 100%, but the rules themselves should apply as expected.
Ordering of selectors may shift if the same selector is seen twice within the stylesheet. The precendence for any given selector is the last time it was seen by the parser.
This method requires you to pass in a params hash that contains scalar css data. For example:
$self->read({css => $css});
Write the parsed and manipulated CSS out to a file parameter
$self->write_file({filename => 'myfile.css'});
Write the parsed and manipulated CSS out to a scalar and return it
Return back any warnings thrown while parsing a given block of css
Note: content warnings are initialized at read time. In order to receive back content feedback you must perform read() first.
Get an array of selectors that represents an inclusive list of all selectors stored.
Get a hash that represents the various properties for this particular selector
$self->get_properties({selector => '.foo'});
Determine if a selector exists within the stored rulesets
$self->check_selector({selector => '.foo'});
Modify an existing selector
Modifying a selector maintains the existing selectivity of the rule with relation to the original stylesheet. If you want to ignore that selectivity, delete the element and re-add it to CSS::Simple
$self->modify_selector({selector => '.foo', new_selector => '.bar' });
Add a selector and associated properties to the stored rulesets
In the event that this particular ruleset already exists, invoking this method will simply replace the item. This is important - if you are modifying an existing rule using this method than the previously existing selectivity will continue to persist. Delete the selector first if you want to ignore the previous selectivity.
$self->add_selector({selector => '.foo', properties => {color => 'red' }});
Add properties to an existing selector, preserving the selectivity of the original declaration.
In the event that this method is invoked with a selector that doesn't exist then the call is just translated to an add_selector call, thus creating the rule at the end of the ruleset.
$self->add_properties({selector => '.foo', properties => {color => 'red' }});
Delete a selector from the ruleset
$self->delete_selector({selector => '.foo' });
Delete a property from a specific selectors rules
$self->delete_property({selector => '.foo', property => 'color' });
This code has been developed under sponsorship of MailerMailer LLC, http://www.mailermailer.com/
Kevin Kamel <kamelkev@mailermailer.com>
kamelkev@mailermailer.com
This module is directly based off of Adam Kennedy's <adamk@cpan.org> CSS::Tiny module.
This particular version differs in terms of interface and the ultimate ordering of the CSS.
This module is a derived version of Adam Kennedy's CSS::Tiny Module.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install Catalyst::Controller::SimpleCAS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Controller::SimpleCAS
CPAN shell
perl -MCPAN -e shell install Catalyst::Controller::SimpleCAS
For more information on module installation, please visit the detailed CPAN module installation guide.