Skip to content

Commit b295802

Browse files
committed
pass and honor strip_extension option to build_directory()
1 parent 2642ccf commit b295802

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sassutils/builder.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
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):
3131
"""Compiles all Sass/SCSS files in ``path`` to CSS.
3232
3333
: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',
5858
if name[0] == '_':
5959
# Do not compile if it's partial
6060
continue
61+
if strip_extension:
62+
name, _ = os.path.splitext(name)
6163
css_fullname = os.path.join(css_path, name) + '.css'
6264
css = compile(filename=sass_fullname,
6365
output_style=output_style,
@@ -73,7 +75,8 @@ def build_directory(sass_path, css_path, output_style='nested',
7375
subresult = build_directory(sass_fullname, css_fullname,
7476
output_style=output_style,
7577
_root_sass=_root_sass,
76-
_root_css=_root_css)
78+
_root_css=_root_css,
79+
strip_extension=strip_extension)
7780
result.update(subresult)
7881
return result
7982

@@ -201,7 +204,8 @@ def build(self, package_dir, output_style='nested'):
201204
css_path = os.path.join(package_dir, self.css_path)
202205
css_files = build_directory(
203206
sass_path, css_path,
204-
output_style=output_style
207+
output_style=output_style,
208+
strip_extension=self.strip_extension
205209
).values()
206210
return frozenset(os.path.join(self.css_path, filename)
207211
for filename in css_files)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy