[Catalyst] process stand alone css file with TT?

Kieren Diment diment at gmail.com
Thu Jul 24 23:38:01 BST 2008


On 25 Jul 2008, at 07:28, Kyle Godbold wrote:

> Andrew Rodland wrote:
>> On Thursday 24 July 2008 03:11:26 pm Kyle Godbold wrote:
>>
>>> Is there any way to use Template Toolkit to render a stand alone
>>> css page that can be linked in with <link rel="stylesheet"> ? I've
>>> tried rendering it through its own function and it will render the
>>> css but the output isn't recognized and used by any page when its  
>>> linked.
>>> I'm not sure if its the header thats sent or the fact that it has  
>>> no .css
>>> extention in the filename when its downloaded.
>>>
>>> sub style :Local {
>>>     my ( $self, $c ) = @_;
>>>     $c->stash->{template} = "style.css"; }
>>>
>>
>> $c->res->content_type('text/css'); perhaps?
>>
>> Andrew
>>
> Thanks Andrew, it works perfect now that your line is added.
>
> sub style :Local {
>    my ( $self, $c ) = @_;
>    $c->res->content_type('text/css');
>    $c->stash->{template} = "style.css"; }
>
> _

Except that unless you've got some processing logic in your css file,  
you want to put your css in root/static/css (or wherever) and have  
static::simple (or the web server deal with it -

[% c.uri_for('/static/css/style.css' %]



More information about the Catalyst mailing list