Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.stringify() parses curly braces for SASS #8

Open
GavinRay97 opened this issue May 18, 2019 · 0 comments
Open

.stringify() parses curly braces for SASS #8

GavinRay97 opened this issue May 18, 2019 · 0 comments
Labels

Comments

@GavinRay97
Copy link
Contributor

In stringify.js, mods.block is hardcoded to curlies.

If the argument signature is changed to:

const stringify = (node, options = { depth: 0, syntax: 'css' }) => {

and the mod declaration moved inside of the stringify closure, with one additional change made to buffer = node.children.reduce() so that it is

buffer = node.children.reduce(
  (buff, child) =>
    buff.concat(
      stringify(child, { depth: options.depth + 1, syntax: options.syntax }), // <-- PASSING OPTS HERE
    ),
  [],
)

Then we change mods.block

const mods = {
  'block': (options.syntax != 'sass') && curlies,
  // etc
}

The issue is resolved.

const sassAST = sast.parse(mockSASS, {syntax: 'sass'})
sast.stringify(sassAST, {syntax: 'sass'})

I can submit PR for this tomorrow.

@shawnbot shawnbot added the bug label May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants