import { render , Result , SassError } from 'node-sass' ; import * as nodeSassTildeImporter from 'node-sass-tilde-importer' ; /**
 * SASS Transformer
 */ export class SASSTransformer { param sassContent returns public static compileToCss ( sassContent ) { return new Promise < string > ( ( resolve , reject ) : void => { if ( sassContent . trim ( ) === '' ) { resolve ( '' ) ; } else { render ( { data : sassContent , importer : [ nodeSassTildeImporter ] , outputStyle : 'expanded' } , ( error , sassRenderResult ) : void => { if ( error ) { reject ( new Error ( `SASS Compiler: ${ error . message } (at ${ error . line }:${ error . column })` ) ) ; return ; } resolve ( sassRenderResult . css . toString ( ) ) ; } ) ; } } ) ; } }