27
27
28
28
29
29
def build_directory (sass_path , css_path , output_style = 'nested' ,
30
- _root_sass = None , _root_css = None ):
30
+ _root_sass = None , _root_css = None , strip_extension = False ):
31
31
"""Compiles all Sass/SCSS files in ``path`` to CSS.
32
32
33
33
:param sass_path: the path of the directory which contains source files
@@ -58,6 +58,8 @@ def build_directory(sass_path, css_path, output_style='nested',
58
58
if name [0 ] == '_' :
59
59
# Do not compile if it's partial
60
60
continue
61
+ if strip_extension :
62
+ name , _ = os .path .splitext (name )
61
63
css_fullname = os .path .join (css_path , name ) + '.css'
62
64
css = compile (filename = sass_fullname ,
63
65
output_style = output_style ,
@@ -73,7 +75,8 @@ def build_directory(sass_path, css_path, output_style='nested',
73
75
subresult = build_directory (sass_fullname , css_fullname ,
74
76
output_style = output_style ,
75
77
_root_sass = _root_sass ,
76
- _root_css = _root_css )
78
+ _root_css = _root_css ,
79
+ strip_extension = strip_extension )
77
80
result .update (subresult )
78
81
return result
79
82
@@ -201,7 +204,8 @@ def build(self, package_dir, output_style='nested'):
201
204
css_path = os .path .join (package_dir , self .css_path )
202
205
css_files = build_directory (
203
206
sass_path , css_path ,
204
- output_style = output_style
207
+ output_style = output_style ,
208
+ strip_extension = self .strip_extension
205
209
).values ()
206
210
return frozenset (os .path .join (self .css_path , filename )
207
211
for filename in css_files )
0 commit comments