NAME

Mojolicious::Plugin::AssetPack::Preprocessor::Scss - Preprocessor for .scss files

DESCRIPTION

Mojolicious::Plugin::AssetPack::Preprocessor::Scss is a preprocessor for .scss files. This module inherits all the functionality from Mojolicious::Plugin::AssetPack::Preprocessor::Sass.

You need either the "sass" executable or the cpan module CSS::Sass to make this module work:

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

...

$ sudo cpanm CSS::Sass

You can force using the executable by setting the environment variable ENABLE_LIBSASS_BINDINGS to a false value.

SASS_PATH

The environment variable SASS_PATH can be used to instruct this module to search for @import files in directories other than relative to the the file containing the @import statement.

Note that SASS_PATH needs to hold absolute paths to work properly.

Example usage:

local $ENV{SASS_PATH} = "/some/dir:/usr/share/other/dir";
$app->asset("app.css" => "sass/app.scss");

It is also possible to set the "include_paths" attribute instead of using global variables:

$app->asset->preprocessors->add(scss => Scss => {include_paths => [...]});
$app->asset("app.css" => "sass/app.scss");

The final list of directories to search will be:

1. dirname $main_sass_file
3. $self->include_paths()
2. split /:/, $ENV{SASS_PATH}

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 and you probably have to set ENABLE_LIBSASS_BINDINGS to a false value to make it work.

You can disable compass detection by setting the environment variable MOJO_ASSETPACK_NO_COMPASS to a true value.

ATTRIBUTES

executable

$path = $self->executable;

Holds the path to the "sass" executable. Default to just "sass".

include_paths

$self = $self->include_paths(\@paths);
$paths = $self->include_paths;

Holds optional paths to search for where to find @import files.

METHODS

can_process

Returns true if "executable" points to an actual file.

checksum

Returns the checksum for the given $text, but also checks for any @import statements and includes those files in the checksum.

See "process" in Mojolicious::Plugin::AssetPack::Preprocessor.

process

This method use "sass" to process $text.

See "process" in Mojolicious::Plugin::AssetPack::Preprocessor.

COPYRIGHT AND LICENSE

Copyright (C) 2014, Jan Henning Thorsen

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org