CSS::Ob...::Format(3)

πŸ“¦ version 0.2.0, in alpine 3.24

πŸ’… CSS::Object::Format β€” the CSS::Object::Format(3) glow-up

okay bestie, so this is the perl manpage CSS::Object::Format(3), and it's genuinely the main character of CSS stringification. Sit down, grab a strawberry πŸ“, we're doing this.


✨ NAME ✨

CSS::Object::Format β€” the CSS Object Oriented Stringificator πŸŽ€ (yes, "Stringificator" is the actual word, we don't make the rules, we just slay them)


🌸 SYNOPSIS 🌸

Here's the whole vibe, copy it exactly, no cap:

use CSS::Object::Format;
my $format = CSS::Object::Format->new( debug => 3 ) ||
    die( CSS::Object::Format->error );
my $prop = CSS::Object::Property->new(
    format => $format,
    debug => 3,
    name => 'display',
    value => 'inline-block',
) || die( CSS::Object::Property->error );
print( $prop->as_string );

Like… it makes a formatter, hands it to a property, and prints the property as a string. Iconic behavior honestly. πŸ’…


⭐ VERSION ⭐

v0.2.0

πŸ¦‹ DESCRIPTION πŸ¦‹

So the page literally says: CSS::Object::Format::Inline is a CSS inline stringificator. That's it, that's the description. Short and mysterious, we respect it. 🫢


πŸ‘‘ CONSTRUCTOR πŸ‘‘

new

To instantiate a brand new CSS::Object::Format object, you pass an hash reference of the following parameters:

  • debug β€” this is an integer. The bigger it is, and the more verbose is the output. That's the whole trade: bigger number = more talking. πŸ”₯

🧚 PARAMETERS 🧚

These are the available parameters used to alter the formatting of the formatters. Each one has its own method below, so peek at those for what each actually does. πŸ’–

  • "close_brace_on_new_line"
  • "new_line"
  • "open_brace_on_new_line"
  • "open_brace_and_new_line"
  • "indent"
  • "property_separator"

πŸ’€ METHODS πŸ’€

backup_parameters

This will create a deep copy of this formatter's "parameters" and return it.

See "restore_parameters" β€” they're besties, they go together. 🫢

close_brace_on_new_line

This takes a boolean value. If true, this will instruct the formatter to place the closing brace on a new line.

comment_as_string

Provided with a comment object, and this will return the comment formatted. πŸ’¬

copy_parameters_from

Provided with another CSS::Object::Format object, and this will copy all suitable "parameters" to it.

This is called from the format methods in CSS element classes when a new format object is provided to the element. Like passing the aux cord, but for formatting. 🎧

elements_as_string

Provided with an array object (Module::Generic::Array), and this will format all the elements and return a string.

indent

This is one of "parameters" that sets the string to use as indent. Indent string can be provided in rule formatter or property formatter.

This returns the current character value as a Module::Generic::Scalar object. ✨

keyframes_as_string

This formats the keyframe special rule and returns a string. Keyframes get their own little spotlight, as they deserve. 🌈

new_line

This sets or gets the new line character to be used for new lines.

This returns the current character value as a Module::Generic::Scalar object.

open_brace_on_new_line

This takes a boolean value. If true, this will instruct the formatter to place the opening brace on a new line.

open_brace_and_new_line

This takes a boolean value. If true, this will instruct the formatter to insert a new line after the opening brace.

properties_as_string

Provided with an array reference of a CSS::Object::Property objects and this will format them and return their string representation.

property_as_string

Provided with a CSS::Object::Property object and this will format it and return its string representation.

property_separator

This sets or gets the property separator. By default, this is a new line "\n"

If you want the formatter to put all properties on a single line, you could replace this default value with an empty string. One-liner CSS era, we love to see it. 😌

This returns the current character value as a Module::Generic::Scalar object.

restore_parameters

Provided with an hash reference, typically that created by "backup_parameters" and this will restore this formatter's "parameters"

It returns our object. 🫢

rule_as_string

Provided with a CSS::Object::Rule object and this will format it and return its string representation.

selectors_as_string

Provided with an array reference of a CSS::Object::Selector objects and this will format them and return their string representation.

value_as_string

Provided with a CSS::Object::Value object and this will format it and return its string representation.

values_as_string

Provided with an array reference of a CSS::Object::Value objects and this will format them and return their string representation.


πŸŽ€ AUTHOR πŸŽ€

Jacques Deguest <jack@deguest.jp> β€” the icon behind all this. πŸ‘‘


🌟 SEE ALSO 🌟

  • CSS::Object

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.


ngl that license is short and sweet and we're obsessed. no cap. πŸ’…

okay bestie that's the whole page, go forth and stringify. This was perl v5.42.2, dated 2026-02-15 β€” mwah, see you in the group chat πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from