spirit-less
v1.0.0
Published
A less parser for the Spirit static file generator
Readme
Spirit Less
Summary
A less parser middleware for the Spirit Core static file generator.
Instalation
install through npm .
npm install spirit-less
Usage
To use simply add an optional markdown config object to the Spirit Core configuration.
And pass it to the spirit-posts middleware to the Spirit Cores use method.
Configuration
The less middleware will look for these configurations.
src String :
The relative source directory path to parse the less files from.
Default value is "less".
dest String :
The relative destination directory path to write the parsed source files to.
Default value is "css".
paths Array :
An array of path strings relative to the less src path for less imports.
By default the less src path is included for imports.
compress Boolean :
If set to true will compress the less files when parsing.
Default value is false.
Example
Directory Structure
> = Directory
- = File
> "example"
> "src"
> "less"
- "file1.less"
- "file2.less"
> "dest"
In file file1.less
@import 'file2.less' ;
p {
color : rgb( 45, 47, 49 ) ;
}And in file2.less
html, body {
background-color: rgb( 245, 247, 249 ) ;
}Then simply initialize the Spirit Core constructor with the desired configuration and pass it the middleware.
var config = {
src : "src",
dest : "dest",
less : {
paths : [ '../' ],
src : "less/file1.less",
dest : "css/main.css",
compress : true ,
}
}
var SpiritCore = require( 'spirit-core' ) ;
var spiritLess = require( 'spirit-less' ) ;
var spirit = new SpiritCore( "./example", config ) ;
spirit.use( spiritLess ) ;
spirit.run( ) ;And the output directory structure will look like this.
> = Directory
- = File
> "example"
> "src"
> "less"
- "file1.less"
- "file2.less"
> "dest"
> "css"
- "main.css"In "main.css"
html,body{background-color:rgb( 245, 247, 249 );}p{color:rgb( 45, 47, 49 );}The middleware uses the official less parser you can find here .
For more information please see the Spirit Core repository.
Hand made in San Francisco California by Alex Ray .
