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

NAME

Mojolicious::Plugin::AssetPack::Preprocessors - Holds preprocessors

METHODS

add

  $self->add($extension => $cb);

Define a preprocessor which is run on a given file extension. These preprocessors will be chained. The callbacks will be called in the order they where added.

The default preprocessor defined is described under "detect".

detect

Will add the following preprocessors, if they are available:

  • less

    LESS extends CSS with dynamic behavior such as variables, mixins, operations and functions. See http://lesscss.org for more details.

    Installation on Ubuntu and Debian:

      $ sudo apt-get install npm
      $ sudo npm install -g less
  • scss

    Sass makes CSS fun again. Sass is an extension of CSS3, adding nested rules, variables, mixins, selector inheritance, and more. See http://sass-lang.com for more information.

    Installation on Ubuntu and Debian:

      $ sudo apt-get install rubygems
      $ sudo gem install sass
  • js

    Javascript is minified using JavaScript::Minifier::XS. This module is optional and must be installed manually.

    EXPERIMENTAL! Not sure if this is the best minifier.

  • css

    CSS is minified using CSS::Minifier::XS. This module is optional and must be installed manually.

    EXPERIMENTAL! Not sure if this is the best minifier.

process

  $self->process($extension => $assetpack, \$text, $filename);

Will run the preprocessor callbacks added by "add". The callbacks will be called with the $assetpack object as the first argument.

remove

  $self->remove($extension);
  $self->remove($extension => $cb);

This method will remove all preprocessors defined for an extension, or just a given $cb.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org