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

Multiline strings with backslashes are silently truncated (CRLF/Windows version) #1067

Closed
am11 opened this issue Apr 7, 2015 · 3 comments · Fixed by #1066
Closed

Multiline strings with backslashes are silently truncated (CRLF/Windows version) #1067

am11 opened this issue Apr 7, 2015 · 3 comments · Fixed by #1066

Comments

@am11
Copy link
Contributor

am11 commented Apr 7, 2015

Related to #942.

Given the following input:

$v: ".foo \
.bar";

#{$v} {
    color: #F00;
}

div {
    content: "foo\
bar";
}

The output is:

.foo.bar {\n color: #F00; }\n\ndiv {\n content: "fobar"; }\n

if and only if the CRLF linefeeds were used in the input.

Further notes:

Using node-sass master:

:: this is cmd
mkdir \temp
notepad c:\temp\blah.scss :: type the aforementioned Sass code, save and close notepad
cd path\to\node-sass\cloned\directory
node
require('./').renderSync({file:'c:/temp/blah.scss'}).css.toString()

outputs:

'.foo.bar {\n  color: #F00; }\n\ndiv {\n  content: "fobar"; }\n'

Ctrl+C to exit node.js REPL.

Run:

:: assuming you have mingw in your path
dos2unix c:/temp/blah.scss
:: dos2unix utility replaces \r\n with \n
:: dos2unix utility is reciprocal of unix2dos utility
node
require('./').renderSync({file:'c:/temp/blah.scss'}).css.toString()

outputs:

'.foo.bar {\n  color: #F00; }\n\ndiv {\n  content: "foobar"; }\n'  //expected output 
                                                                   // (the 'o' in foobar is not
                                                                   //  missing anymore)
@mgreter
Copy link
Contributor

mgreter commented Apr 7, 2015

First part would have been enough 😉 Once I knew what to look for it was a pretty easy fix.
Probably took less time to fix it (#1066) than to write this.
Now I'll have a 🍺 and checkout the sourcemap issues.

@am11
Copy link
Contributor Author

am11 commented Apr 7, 2015

👍
Good idea; and I will go out and get some fresh oxygen 🚬 😸

On this note, should we configure appveyor to clone sass-spec repo with CRLF ending to test Windows environment verbatim?

@mgreter
Copy link
Contributor

mgreter commented Apr 7, 2015

I like and fear that idea 😈 On this account I think I still have not enabled windows linefeeds on windows by default. Would be a good time to actually try it out. Although I'm not sure if the spec runner really is that picky about lineending types currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants