Skip Menu |

This queue is for tickets about the CSS CPAN distribution.

Report information
The Basics
Id: 68297
Status: new
Priority: 0/
Queue: CSS

People
Owner: Nobody in particular
Requestors: cheako [...] mikemestnik.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Expanding the usefulness with better support for building CSS.
Date: Wed, 18 May 2011 18:45:55 -0500
To: bug-CSS [...] rt.cpan.org
From: Mike Mestnik <cheako [...] mikemestnik.net>
Thus far I have two code examples that seam to work, however CSS currently lacks a simple API for building Styles. Inline style: print CGI->img( { style=>CSS::Adaptor->new( )->output_properties( [ new CSS::Property ( { property => 'float', value => 'left' } ), new CSS::Property ( { property => 'width', value => ($inline?150:300).'px' } ) ] ), alt=>'Item Image', src=>'http://localhost/favicon.ico', } ); Building a .css: my $css = new CSS({'adaptor'=>'CSS::Adaptor::Pretty'}); print CGI->header(-type=>'text/css'); my $columns=CGI->param('columns')||1; $columns=1 if ($columns<1); my $inline=CGI->param('inline'); my $style = new CSS::Style; $style->add_selector(new CSS::Selector({name=>'div.outer_auction'})); $style->add_property(new CSS::Property ( { property => 'width', value => ($inline?100/$columns.'%':'100%') } )); $style->add_property(new CSS::Property ( { property => 'overflow', value => 'hidden' } )); push @{$css->{styles}}, $style; print $css->output(); Currently functions that don't work are sanitation and where available quoting/escaping. Currently a ';' in a property is just passed.