Prty::Css - Generierung von CSS Code
$rule = Prty::Css->rule($selector,@propVal);
Generiere eine CSS Style Rule, bestehend aus Selector $selector und den Property/Value-Paaren @propVal und liefere diese als Zeichenkette zurück.
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; }
$styleTags = Prty::Css->style($h,@specs);
Übersetze die Style-Spezifikationen @specs in eine Folge von <link>- und/oder <style>-Tags.
Mögliche Style-Spezifikationen:
Datei $file wird geladen und ihr Inhalt wird hinzugefügt.
Zeichenkette $string wird hinzugefügt.
Zeichenkette wird als URL interpretiert und ein <link>-Tag
<link rel="stylesheet" type="text/css" href="$url" />
hinzugefügt.
Wird zu @specs expandiert.
Liste von Style-Spezifikationen.
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.
1.111
Frank Seitz, http://fseitz.de/
Copyright (C) 2017 Frank Seitz
This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Prty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Prty
CPAN shell
perl -MCPAN -e shell install Prty
For more information on module installation, please visit the detailed CPAN module installation guide.