source-map option causes warn_about_public_url cause by mixing up slash and backslash in call to relative_path_from #1135

Closed
pasdut opened this Issue Feb 26, 2014 · 2 comments

Comments

Projects
None yet
2 participants

pasdut commented Feb 26, 2014

SASS 3.3.0.rc.5 - Windows 8.1 x64

I'm calling SASS from within gulp-sass and I get the warn_about_public_url.

I confirm gulp-sass is sending correct filenames (the spawn is :sass C:\Users\pascal\AppData\Local\Temp\46f2af77-e238-473f-a0d6-ff6b97cc09c1\main.scss C:\Users\pascal\AppData\Local\Temp\46f2af77-e238-473f-a0d6-ff6b97cc09c1\main.css --load-path C:\Pascal Documenten\projecten\Specialleke\site-dev.002\styles --sourcemap) But if I print the values from the variables dest_directory and base_directory infrom relative_path_from(pathname.rb) then I see that sometimes the '' is replaced by a '/'.

I quick fixed this by following patch on relative_path, but I guess this is a sass issue (probably in filesystem.rb?)

def relative_path_from(base_directory)
  #pascal patched :         
  #dest_directory = self.cleanpath.to_s
  #base_directory = base_directory.cleanpath.to_s
  # hardcoded fix only for windows
  dest_directory = self.cleanpath.to_s.capitalize!.gsub("/", "\\")
  base_directory = base_directory.cleanpath.to_s.capitalize!.gsub("/", "\\")

This is a debug log of one call to SASS to compile with source_map

[relative_path_from patch]base :C:\users/pascal/appdata/local/temp/33d81f64-28a8-41f6-b3c1-23074ec13efd
[relative_path_from patch]dest: C:\users/pascal/appdata/local/temp/33d81f64-28a8-41f6-b3c1-23074ec13efd/main.css

Here below you see that the second time the relative_path_from is called, the base has a backslash after "C:" while destination has a slash after "C:"

[relative_path_from patch]base :C:\users/pascal/appdata/local/temp/33d81f64-28a8-41f6-b3c1-23074ec13efd
[relative_path_from patch]dest: C:/users/pascal/appdata/local/temp/33d81f64-28a8-41f6-b3c1-23074ec13efd/main.scss

Same goes for the third call to relative_path_from

[relative_path_from patch]base :C:\users/pascal/appdata/local/temp/33d81f64-28a8-41f6-b3c1-23074ec13efd
[relative_path_from patch]dest: C:/users/pascal/appdata/local/temp/33d81f64-28a8-41f6-b3c1-23074ec13efd/main.scss

@nex3 nex3 added the Bug label Feb 26, 2014

@nex3 nex3 added this to the 3.3 milestone Feb 26, 2014

Contributor

nex3 commented Feb 28, 2014

Can you provide a simple case that I can reproduce locally? In particular, one of more Sass files that produce an unexpected warning, and a command-line invocation of the sass executable that causes that warning to be emitted.

pasdut commented Mar 1, 2014

Hi,

It is a simple trivial file : main.scss :

$myColor:#123456;

body{
.box {
color: $myColor;
}
}

I compile using :

sass c:\test\main.scss c:\test\main.css --sourcemap

C:\test>dir
Volume in drive C is WIN8
Volume Serial Number is A6F8-B63E

Directory of C:\test
01/03/2014 21:22

.
01/03/2014 21:22 ..
01/03/2014 21:13 68 main.scss

C:\test> sass c:\test\main.scss c:\test\main.css --sourcemap
WARNING: Couldn't determine public URL for "c:\test\main.scss" while generating sourcemap.
Without a public URL, there's nothing for the source map to link to.

C:\test>dir
Volume in drive C is WIN8
Volume Serial Number is A6F8-B63E

Directory of C:\test
01/03/2014 21:22

.
01/03/2014 21:22 ..
01/03/2014 21:22 .sass-cache
01/03/2014 21:22 74 main.css
01/03/2014 21:22 88 main.css.map
01/03/2014 21:13 68 main.scss

           3 File(s)            230 bytes

C:\test>sass -v

Sass 3.3.0.rc.5 (Maptastic Maple)

This is the contents of the generated map file :
{
"version": 3,
"mappings": "",
"sources": [],
"names": [],
"file": "main.css"
}

From: Nathan Weizenbaum [mailto:notifications@github.com]
Sent: vrijdag 28 februari 2014 22:23
To: nex3/sass
Cc: Pascal
Subject: Re: [sass] source-map option causes warn_about_public_url cause by mixing up slash and backslash in call to relative_path_from (#1135)

Can you provide a simple case that I can reproduce locally? In particular, one of more Sass files that produce an unexpected warning, and a command-line invocation of the sass executable that causes that warning to be emitted.


Reply to this email directly or view it on GitHub nex3#1135 (comment) . https://github.com/notifications/beacon/3137770__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwOTE1NTM4OCwiZGF0YSI6eyJpZCI6MjY1MzU0MDN9fQ==--cc1b435d2220c08b1a96fbd318c7890f98e92475.gif

nex3 added a commit that referenced this issue Mar 7, 2014

Avoid Pathname canonicalization errors on Windows.
Pathname doesn't canonicalize Windows directory separators, which was
causing #relative_path_from to fail. We now do this canonicalization
manually.

Closes #1135

@nex3 nex3 closed this Mar 7, 2014

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