postcss-node-sass
postcss-node-sass copied to clipboard
Not working with .sass
Sass indented syntax is not being transformed.
// Main.sass
#app
height: 100%
html, body
height: 100%
font-size: 14px
const postcss = require('postcss');
const syntaxSASS = require('postcss-sass');
const sass = require('postcss-node-sass');
const options = { syntax: syntaxSASS };
const plugins = [sass({ indentedSyntax: true })];
const { css, map } = await postcss(plugins)
.process(content, options);
/* Main.css */
#app
height: 100%
html, body
height: 100%
font-size: 14px
The problem here is that plugin use stringifier first to obtain text from AST and then to generate final result, if stringifier is absent - an error will occur when trying to build a string to pass to node-sass. To avoid it - initial stringifier should be passed as an additional option for the plugin (with default value equal to syntax.stringify and fallback to postcss.stringify).