dougludlow / plugin-sass

SystemJS SASS loader plugin
MIT License
52 stars 27 forks source link

Bundling fails if the resolved absolute path of an @import contains a space #44

Closed micahlee closed 8 years ago

micahlee commented 8 years ago

Hello,

I ran into an issue today where I was getting a "File to import not found or unreadable" when bundling a jspm (v0.16.31) module that included a Sass file that contain @import statements for other Sass files in the same directory. The runtime Sass compiling was working fine.

Upon digging a little further, this appears to be because the resolved sass import path contains spaces which initially get encoded to '%20'. The fromFileUrl function in sass-builder.js doesn't decode the spaces again and the resulting filepath (on Windows) is incorrect.

I patched sass-builder.js locally by adding decodeURIComponent: sass-builder.js:39 => const address = decodeURIComponent(url.replace(/^file:(\/+)?/i, ''));

This resolves the issue for me, but there may be other factors I haven't considered in complete solution.

Thanks for a great plugin!

screendriver commented 8 years ago

Fixed and made a new release. Could you please test if it's working on your machine?

Independently of that you should really avoid spaces in your path. Regardless which OS you are using :wink:

micahlee commented 8 years ago

Confirmed. Everything looks good, thanks! :)

screendriver commented 8 years ago

decodeURIComponent() existed in the past but for some reasons I don't remember why it was removed.