CSS::Struct::Output::Indent::ANSIColor - Indent printing 'CSS::Struct' structure to CSS code with ansi color output.
use CSS::Struct::Output::Indent::ANSIColor; my $css = CSS::Struct::Output::Indent::ANSIColor->new(%parameters); my $ret_or_undef = $css->flush($reset_flag); $css->put(@data); $css->reset;
new
my $css = CSS::Struct::Output::Indent::ANSIColor->new(%parameters);
Constructor.
Returns instance of object.
auto_flush
Auto flush flag. Default is 0.
comment_delimeters
Reference to array with begin and end comment delimeter. Default value is ['/*', '*/']. Possible values are: - ['/*', '*/'] - ['<!--', '-->'],
next_indent
Indent string. Default value is TAB.
output_handler
Handler for print output strings. Must be a GLOB. Default is undef.
skip_bad_types
Flag, that means bad 'CSS::Struct' types skipping. Default value is 0.
skip_comments
Flag, that means comment skipping. Default value is 0.
flush
my $ret_or_undef = $css->flush($reset_flag);
Flush CSS structure in object. If defined 'output_handler' flush to its. Or return CSS. If enabled $reset_flag, then resets internal variables via reset method.
Returns output string or undef.
put(@data)
$css->put(@data);
Put CSS structure in format specified in CSS::Struct.
Returns undef.
reset
$css->reset;
Resets internal variables.
From CSS::Struct::Output: Auto-flush can't use without output handler. Bad comment delimeters. Bad data. Bad number of arguments. ('CSS::Struct' structure array), Bad type of data. Cannot write to output handler. No opened selector. Output handler is bad file handler. Unknown parameter '%s'.
use strict; use warnings; use CSS::Struct::Output::Indent::ANSIColor; my $css = CSS::Struct::Output::Indent::ANSIColor->new( 'output_handler' => \*STDOUT, ); $css->put(['c', 'Nice selector.']); $css->put(['a', '@import', 'file.css']); $css->put(['s', 'selector#id']); $css->put(['s', 'div div']); $css->put(['s', '.class']); $css->put(['s', 'p.class']); $css->put(['d', 'weight', '100px']); $css->put(['d', 'font-size', '10em']); $css->put(['d', '--border-color', 'hsl(0, 0%, 83%)']); $css->put(['e']); $css->flush; print "\n"; # Output (in colors): # /* Nice selector. */ # @import "file.css"; # selector#id, div div, .class, p.class { # weight: 100px; # font-size: 10em; # --border-color: hsl(0, 0%, 83%); # }
CSS::Struct::Output, Indent, Readonly.
Struct oriented CSS manipulation.
Base class for CSS::Struct::Output::*.
Raw printing 'CSS::Struct' structure to CSS code.
Indent printing 'CSS::Struct' structure to CSS code.
https://github.com/michal-josef-spacek/CSS-Struct-Output-Indent-ANSIColor
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2021 Michal Josef Špaček
BSD 2-Clause License
0.01
To install CSS::Struct::Output::Indent::ANSIColor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CSS::Struct::Output::Indent::ANSIColor
CPAN shell
perl -MCPAN -e shell install CSS::Struct::Output::Indent::ANSIColor
For more information on module installation, please visit the detailed CPAN module installation guide.