arpadHegedus / postcss-node-sass

A PostCSS plugin to parse styles with node-sass
MIT License
23 stars 16 forks source link

Not working with .sass #11

Open yuri-karadzhov opened 4 years ago

yuri-karadzhov commented 4 years ago

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
yuri-karadzhov commented 4 years ago

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).