node-sass icon indicating copy to clipboard operation
node-sass copied to clipboard

IndentedSyntax not working together with importer

Open sebakerckhof opened this issue 11 years ago • 12 comments

The indentedSyntax option and the custom importer functionality don't play well together. If I set indentedsyntax to true, it works as long as I don't have any imports. If I have an import and I return a file with indented syntax, it tries to parse this as scss instead of sass.

Here's a very minimal reproduction of the issue: https://github.com/sebakerckhof/node-sass-import-test

Btw, is it valid in sass to import .sass files in .scss files or vice-versa? If so, then the importer should be able to specify for each file if it's indented syntax or not... Or the sass compiler should be smart enough to infer this from the content of a file instead of solely the filename...

sebakerckhof avatar Oct 03 '15 10:10 sebakerckhof

Thanks for the report @sebakerckhof. Thanks heaps for the reproduction repo, that'll make our lives infinitely easier.

is it valid in sass to import .sass files in .scss files or vice-versa

Yes. The file extension should be used to differentiate which parser should be used.

the sass compiler should be smart enough to infer this from the content of a file instead of solely the filename

True. This is something has only very recently surfaced because so few people still used the old syntax.


There has been some discussion on how to best handle this since we will not always have the filename available i.e. importers which return data.

@chriseppstein could you please elaborate on how this is handled with Ruby Sass?

xzyfer avatar Oct 05 '15 04:10 xzyfer

Since this is external (in libsass). Do I need to make an issue there? Also, would it be simple enough to let us just hint what syntax is used. E.g return

{
 indentedSyntax: true
 contents: result.data
}

from an Importer.

Or if both the contents and filename are returned, don't read the file, but use the contents and select the right syntax based on the extension of the filename ?

sebakerckhof avatar Oct 22 '15 14:10 sebakerckhof

So for importing *.sass files we have to wait a patch. You guys can covert all sass to scss in one command

sass-convert -R -F sass -T scss .

mikeifomin avatar Nov 19 '15 14:11 mikeifomin

+1

karldanninger avatar Nov 19 '15 20:11 karldanninger

+1

monsterxxx avatar Dec 27 '15 05:12 monsterxxx

+1

Still having this problem in 3.4.1. Had to downgrade to fourseven:scss@=3.2.0.

Has there been any news regarding this?

nscarcella avatar Apr 01 '16 21:04 nscarcella

Any good news with this issue?

mikeifomin avatar Jun 15 '16 15:06 mikeifomin

@xzyfer in ruby sass, the importer specifies which syntax the content string being returned is in.

chriseppstein avatar Jul 01 '16 19:07 chriseppstein

Ruby sass ten times slower :(

On Fri, Jul 1, 2016, 10:45 PM Chris Eppstein [email protected] wrote:

@xzyfer https://github.com/xzyfer in ruby sass, the importer specifies which syntax the content string being returned is in.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sass/node-sass/issues/1192#issuecomment-230032629, or mute the thread https://github.com/notifications/unsubscribe/AAid-ZFmnQX7ge1qVr6Tjrl3npWK2MEYks5qRW5egaJpZM4GIZnd .

mikeifomin avatar Jul 01 '16 19:07 mikeifomin

I'm running into other libraries that have dependencies on the 3.4 branch and can't downgrade (not sure why). Is this being actively worked on?

scottwillman avatar Jul 07 '16 19:07 scottwillman

Any chance this will get resolved?

RobertWHurst avatar Jan 06 '19 21:01 RobertWHurst

I've created a bug with libsass as this is blocked there => https://github.com/sass/libsass/issues/2812

RobertWHurst avatar Jan 06 '19 21:01 RobertWHurst