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:
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.
Installation on Ubuntu and Debian:
$ 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.
Installation on Ubuntu and Debian:
$ 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.
Installation on Ubuntu and Debian:
$ 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: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.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.
coffee
CoffeeScript is a little language that compiles into JavaScript. See http://coffeescript.org for more information.
Installation on Ubuntu and Debian:
$ npm install -g coffee-script
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.
map_type
$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");
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