NAME

Text::Sass::XS - Perl Binding for libsass

SYNOPSIS

# export sass_compile, sass_compile_file and some constants
use Text::Sass::XS ':all';
use Try::Tiny;

my $sass = "your sass string here...";
my $options = {
    output_style    => SASS_STYLE_COMPRESSED,
    source_comments => SASS_SOURCE_COMMENTS_NONE,
    include_paths   => 'site/css:vendor/css',
    image_path      => '/images'
};
try {
    my $css = sass_compile($sass, $options);
    print $css;
}
catch {
    warn $_;
};

my $sass_filename = "/path/to/foo.scss";
my $options = {
    output_style    => SASS_STYLE_COMPRESSED,
    source_comments => SASS_SOURCE_COMMENTS_NONE,
    include_paths   => 'site/css:vendor/css',
    image_path      => '/images'
};
try {
    my $css = sass_compile_file($sass_filename, $options);
    print $css;
}
catch {
    warn $_;
};

DESCRIPTION

Text::Sass::XS is a Perl Binding for libsass.

libsass Project page

CSS::Sass is also using libsass. But CSS::Sass v0.1.0 and v0.2.0 are both broken.

EXPORT

None.

EXPORT_OK

Funcitons

sass_compile($source_string :Str, $options :HashRef)

Returns css string if success. Otherwise throws exception.

Default value of $options is below.

my $options = {
    output_style    => SASS_STYLE_COMPRESSED,
    source_comments => SASS_SOURCE_COMMENTS_NONE, 
    include_paths   => undef,
    image_path      => undef,
};

input_paths is a coron-separated string for "@import". image_path is a string using for "image-url".

sass_compile_file($input_path :Str, $options :HashRef)

Returns css string if success. Otherwise throws exception. $options is same as sass_compile.

Constants

For $options->{output_style}.

SASS_STYLE_NESTED
SASS_STYLE_EXPANDED
SASS_STYLE_COMPACT
SASS_STYLE_COMPRESSED

For $options->{source_comments}.

SASS_SOURCE_COMMENTS_NONE
SASS_SOURCE_COMMENTS_DEFAULT
SASS_SOURCE_COMMENTS_MAP

EXPORT_TAGS

:func

Exports sass_compile and sass_compile_file.

:const

Exports all constants.

:all

Exports :func and :const.

SEE ALSO

Text::Sass

CSS::Sass

LICENSE

Text::Sass::XS

Copyright (C) 2013 Yoshihiro Sasaki.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

libsass

Copyright (C) 2012 by Hampton Catlin.

See libsass/LICENSE for more details.

AUTHOR

Yoshihiro Sasaki <ysasaki@cpan.org>