ctg-compiler
v0.0.2
Published
Sass and dust compiler for client-side templating.
Downloads
7
Readme
Welcome to the ctg-compiler. This is a little compiler module I made which allows compiling of sass and dust files much easier when using client-side templating.
Installation
$ npm install ctg-compiler
Quick Start
A quick example of it's use would be to watch for file changes for both dust and sass files in a project:
compiler = require('ctg-compiler');
compiler.compileSass("public/includes/sass/main.scss",
"public/includes/main.css", false, true);
compiler.compileDust("public/includes/dust/home.dust",
"public/includes/home.js", true);
Note: The paths specified must be relative to the calling script in order for the compiling to be successful.
API Guide
compiler.compileFile(readPath, writePath, watchFile, process)
Reads the contents of the file given from 'readPath' and passes it to the process function. The process function will be given a 'data' parameter containing the data read from readPath. The function will require a return to be written to the given 'writePath'. If you wish to watch a given file, you can set 'watchFile' to true and will thus recompile the file every time a change is made.
compiler.compileSass(readPath, writePath, compressed, watchFile)
Similar to compileFile only a process function is not required, instead a 'compressed' boolean parameter is needed which will affect the outcome of the css file. Used merely to ease compiling of Scss files.
compiler.compileDust(readPath, writePath, watchFile)
Similar to compileFile only a process function is not required. Used merely to ease compiling of Dust files.