sassed ~master
Thin wrapper around libsass.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
sassed
Thin wrapper for libsass written in D Programming Language.
It can
- Compile received string to css and return resulting css code
- Compile single file and put it to a specified folder
- Compile whole folder to multiple files and put it to another folder
- Compile whole folder to a single file
- Compile from
.sass
and.scss
files - Watch input folder and recompile files within output when user changing some of them
Library usage
First of all you should create new Sass object
auto sass = new shared Sass;
Then you should set options you need. Sassed has next configurators:
- Source map - configurates source map generation.
// Enabling source map generaion
sass.options.sourcemap.enable();
// Defining source map file extension (`.map` by default)
sass.options.sourcemap.extension = "newmap" // without a point before extension
// Disabling source mapping url (`true` by default)
sass.options.sourcemap.sourceMappingUrl.disable();
// Embedding source mapping url
sass.options.sourcemap.sourceMappingUrl.embedding.enable();
- Extensions - configurates SASS and SCSS file extensions.
// Defining new SASS extension (`.sass` by default)
sass.options.extensions.sass = "sassmap" // without a point before extension
- SASS to SCSS - configurate SASS to SCSS compilation (only for method
convertSass2Scss
).
// Setting sass2scss prettify level
sass.options.sass2scss.prettifyLevel = PrettifyLevel.ZERO;
// Setting comment conversion
sass.options.sass2scss.stripComments();
- Single file - configurate folder-to-file compilation
// Setting single file name (`style` by default)
sass.options.singleFile.name = "mystyle";
// Enabling single file source comments splitting compiled code blocks from
// different files
sass.options.singleFile.comments.enable();
// Setting placeholder for source comments (`%{filename}` by default)
sass.options.singleFile.comments.placeholder = "%{file}";
// Setting new comment template. Changing placeholder you should always change
// template
sass.options.singleFile.comments.templ = "This code came from: %{file}";
Sassed options:
- Source comments - enables inline source comments
sass.options.sourceComments.enable();
- Indented syntax - enables compiling from SASS instead of SCSS
sass.options.indentedSyntax.enable();
- Style - defines output CSS style. By now libsass supports only
nested
andcompressed
styles.
sass.options.style = SassStyle.COMPRESSED;
- Include path - defines
@import
directive search location
sass.options.includePaths = "path/to/import";
- Image path - defines optional path to find images
sass.options.imagePath = "path/to/images";
- Precision - defines number precision of computed values
sass.options.precision = 2;
After setting options you can compile your files by next methods:
- String-to-string compilation (also you can get source map string by
out
parameter in overloaded method signature) - File-to-file / file-to-string compilation (source map string available)
- Folder-to-folder / folder-to-file compilation
- Folder watching. This method creates thread watching some directory and compiling changed file (or all folder if
singleFile
is enabled). Be careful: if you change sass options, it will change in watching thread too.
// String-to-string compilation method with getting source map string
string sourcemap;
auto code = "#map{ & .inner-map {} }"
auto result = sass.compile( code, sourcemap );
Console usage
Simple compiling file to file
$ ./sassed some.scss some.css -m
Compiling folder to folder
$ ./sassed folder path/to/input path/to/output
Compiling folder to single file. Folder will be compiled in path/to/output/style.css.
$ ./sassed folder path/to/input path/to/output -u
Watching folder
$ ./sassed watch path/to/input path/to/output
More about options can be find in help
$ ./sassed -h
- ~master released 9 years ago
- Lodin/sassed
- BSL-1.0
- Authors:
- Dependencies:
- derelict-sass, libasync
- Versions:
-
0.2.0 2015-Jan-29 0.1.0 2015-Jan-21 ~master 2015-Jan-29 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
209 downloads total
-
- Score:
- 0.7
- Short URL:
- sassed.dub.pm