The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Prty::Css - Generierung von CSS Code

METHODS

Klassenmethoden

rule() - Generiere CSS Style Rule

Synopsis

    $rule = Prty::Css->rule($selector,@propVal);

Description

Generiere eine CSS Style Rule, bestehend aus Selector $selector und den Property/Value-Paaren @propVal und liefere diese als Zeichenkette zurück.

Example

Erzeuge eine einfache Style Rule:

    $rule = Prty::Css->rule('p.abstract',
        fontStyle=>'italic',
        marginLeft=>'0.5cm',
        marginRight=>'0.5cm',
    );

liefert

    p.abstract {
        font-style: italic;
        margin-left: 0.5cm;
        margin-right: 0.5cm;
    }

style() - Generiere StyleSheet-Tags

Synopsis

    $styleTags = Prty::Css->style($h,@specs);

Description

Übersetze die Style-Spezifikationen @specs in eine Folge von <style>- und/oder <style>-Tags.

Mögliche Style-Spezifikationen:

"inline:$file":

Datei $file wird geladen und ihr Inhalt wird hinzugefügt.

$string (Zeichenkette mit enthaltenen '{')

Zeichenkette $string wird hinzugefügt.

$url (Zeichenkette ohne '{'):

Zeichenkette wird als URL interpretiert und ein <link>-Tag

    <link rel="stylesheet" type="text/css" href="$url" />

hinzugefügt.

\@specs (Arrayreferenz):

Wird zu @specs expandiert.

Arguments

@specs

Liste von Style-Spezifikationen.

Example

Code zum Laden eines externen Stylesheet:

    $style = Prty::Css->style('/css/stylesheet.css');
    =>
    <link rel="stylesheet" type="text/css" href="/css/stylesheet.css" />

Stylesheet aus Datei einfügen:

    $style = Prty::Css->style('inline:/css/stylesheet.css');
    =>
    <Inhalt der Datei /css/stylesheet.css>

Mehrere Stylesheet-Spezifikationen:

    $style = Prty::Css->style(
        '/css/stylesheet1.css'
        '/css/stylesheet2.css'
    );
    =>
    <link rel="stylesheet" type="text/css" href="/css/stylesheet1.css" />
    <link rel="stylesheet" type="text/css" href="/css/stylesheet2.css" />

Mehrere Stylesheet-Spezifikationen via Arrayreferenz:

    $style = Prty::Css->style(
        ['/css/stylesheet1.css','/css/stylesheet2.css']
    );

Dies ist nützlich, wenn die Spezifikation von einem Parameter einer umgebenden Methode kommt.

VERSION

1.101

AUTHOR

Frank Seitz, http://fseitz.de/

COPYRIGHT

Copyright (C) 2016 Frank Seitz

LICENSE

This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.