File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ function fileExists(path) {
77 return stat && stat . isFile ( ) ;
88}
99
10+ function removeFileExtension ( path ) {
11+ return path . slice ( 0 , path . lastIndexOf ( '.' ) ) ;
12+ }
13+
1014function importFileToSass ( path , done ) {
1115 // any path must be relative to CWD to work in both environments (real FS, and emscripten FS)
1216 var requestedPath = './' + path ;
@@ -20,13 +24,19 @@ function importFileToSass(path, done) {
2024 return ;
2125 }
2226
27+ // Make sure to omit the ".css" file extension when it was omitted in requestedPath.
28+ // This allow raw css imports.
29+ // see https://github.com/sass/libsass/pull/754
30+ var isRawCss = ! requestedPath . endsWith ( '.css' ) && filesystemPath . endsWith ( '.css' ) ;
31+ var targetPath = isRawCss ? removeFileExtension ( filesystemPath ) : filesystemPath ;
32+
2333 // write the file to emscripten FS so libsass internal FS handling
2434 // can engage the scss/sass switch, which apparently does not happen
2535 // for content provided through the importer callback directly
2636 var content = fs . readFileSync ( filesystemPath , { encoding : 'utf8' } ) ;
2737 Sass . writeFile ( filesystemPath , content , function ( ) {
2838 done ( {
29- path : filesystemPath ,
39+ path : targetPath ,
3040 } ) ;
3141 } ) ;
3242}
You can’t perform that action at this time.
0 commit comments