NAME Mojolicious::Plugin::CSSLoader - move css loading to the end of the document VERSION version 0.08 SYNOPSIS In your startup: sub startup { my $self = shift; # do some Mojolicious stuff $self->plugin( 'CSSLoader' ); # more Mojolicious stuff } In your template: <% css_load('css_file.css') %> HELPERS This plugin adds a helper method to your web application: css_load This method requires at least one parameter: The path to the JavaScript file to load. An optional second parameter is the configuration. You can switch off the base for this CSS file this way: # <% css_load('css_file.css') %> # <% css_load('http://domain/css_file.css', {no_base => 1}); # load css file only in Internet Explorer # <% css_load('css_file.css', {ie => 1}); # load css file except in Internet Explorer # <% css_load('css_file.css', {ie => 0}); # load css file in Internet Explorer greater version 7 # <% css_load('css_file.css', {ie => { '>' => 7 } }); # allowed ie settings: >, >=, <, <=, == HOOKS When you use this module, a hook for after_render is installed. That hook inserts the tag at the end of the
part or at the start of the document. METHODS register Called when registering the plugin. On creation, the plugin accepts a hashref to configure the plugin. # load plugin, alerts are dismissable by default $self->plugin( 'CSSLoader' ); Configuration $self->plugin( 'CSSLoader' => { base => 'http://domain/css', # base for all CSS files media => 'screen', # media setting (default: none) }); NOTES This plugin uses the stash key __CSSLOADERFILES__, so you should avoid using this stash key for your own purposes. AUTHOR Renee Baecker