This repository was archived by the owner on Oct 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -752,6 +752,32 @@ def test_wsgi_sass_middleware_without_extension(self):
752752 self .assertEqual (expected .encode (), r .data )
753753 assert r .mimetype == 'text/css'
754754
755+ def test_wsgi_sass_middleware_without_extension_sass (self ):
756+ with tempdir () as css_dir :
757+ src_dir = os .path .join (css_dir , 'src' )
758+ os .makedirs (src_dir )
759+ with open (os .path .join (src_dir , 'a.sass' ), 'w' ) as f :
760+ f .write ('a\n \t b\n \t \t color: blue;' )
761+ app = SassMiddleware (
762+ self .sample_wsgi_app , {
763+ __name__ : {
764+ 'sass_path' : src_dir ,
765+ 'css_path' : css_dir ,
766+ 'wsgi_path' : '/static' ,
767+ 'strip_extension' : True ,
768+ },
769+ },
770+ )
771+ client = Client (app , Response )
772+ r = client .get ('/static/a.css' )
773+ assert r .status_code == 200
774+ expected = (
775+ 'a b {\n color: blue; }\n \n '
776+ '/*# sourceMappingURL=../a.css.map */'
777+ )
778+ self .assertEqual (expected .encode (), r .data )
779+ assert r .mimetype == 'text/css'
780+
755781
756782class DistutilsTestCase (BaseTestCase ):
757783
Original file line number Diff line number Diff line change @@ -199,8 +199,14 @@ def unresolve_filename(self, filename):
199199 """
200200 filename , _ = os .path .splitext (filename )
201201 if self .strip_extension :
202- filename = filename + '.scss'
203- return filename
202+ for ext in ('.scss' , '.sass' ):
203+ test_path = os .path .join (self .sass_path , filename + ext )
204+ if os .path .exists (test_path ):
205+ return filename + ext
206+ else : # file not found, let it error with `.scss` extension
207+ return filename + '.scss'
208+ else :
209+ return filename
204210
205211 def build (self , package_dir , output_style = 'nested' ):
206212 """Builds the Sass/SCSS files in the specified :attr:`sass_path`.
You can’t perform that action at this time.
0 commit comments