Mojolicious::Plugin::AssetPack::Preprocessors - Holds preprocessors
$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".
Will add the following preprocessors, if they are available:
jsx
JSX is a JavaScript XML syntax transform recommended for use with React. See http://facebook.github.io/react/docs/jsx-in-depth.html for more information.
Installation on Ubuntu and Debian:
$ sudo apt-get install npm $ npm install -g react-tools
less
LESS extends CSS with dynamic behavior such as variables, mixins, operations and functions. See http://lesscss.org for more details.
$ sudo apt-get install npm $ sudo npm install -g less
sass
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. Supports both *.scss and *.sass syntax variants.
$ sudo apt-get install rubygems $ sudo gem install sass
compass
Compass is an open-source CSS Authoring Framework built on top of "sass". See http://compass-style.org/ for more information.
$ sudo apt-get install rubygems $ sudo gem install compass
This module will try figure out if "compass" is required to process your *.scss files. This is done with this regexp on the top level sass file:
*.scss
m!\@import\W+compass\/!;
NOTE! Compass support is experimental.
You can disable compass detection by setting the environment variable MOJO_ASSETPACK_NO_COMPASS to a true value.
MOJO_ASSETPACK_NO_COMPASS
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.
coffee
CoffeeScript is a little language that compiles into JavaScript. See http://coffeescript.org for more information.
$ npm install -g coffee-script
$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.
$assetpack
$self = $self->map_type($from => $to); $to = $self->map_type($from);
Method used to map one file type that should be transformed to another file type. Example:
$self->map_type(coffee => "js");
$self->remove($extension); $self->remove($extension => $cb);
This method will remove all preprocessors defined for an extension, or just a given $cb.
$cb
Jan Henning Thorsen - jhthorsen@cpan.org
jhthorsen@cpan.org
To install Mojolicious::Plugin::AssetPack, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::AssetPack
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::AssetPack
For more information on module installation, please visit the detailed CPAN module installation guide.