summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scss/compiler.py10
-rw-r--r--scss/extension/core.py2
-rw-r--r--scss/legacy.py3
3 files changed, 12 insertions, 3 deletions
diff --git a/scss/compiler.py b/scss/compiler.py
index 96d54ec..82c5390 100644
--- a/scss/compiler.py
+++ b/scss/compiler.py
@@ -86,6 +86,7 @@ class Compiler(object):
def __init__(
self, root=Path(), search_path=(),
namespace=None, extensions=(CoreExtension,),
+ import_static_css=False,
output_style='nested', generate_source_map=False,
live_errors=False, warn_unused_imports=False,
ignore_parse_errors=False,
@@ -137,6 +138,13 @@ class Compiler(object):
.format(extension)
)
+ if import_static_css:
+ self.dynamic_extensions = ('.scss', '.sass', '.css')
+ self.static_extensions = ()
+ else:
+ self.dynamic_extensions = ('.scss', '.sass')
+ self.static_extensions = ('.css',)
+
self.output_style = output_style
self.generate_source_map = generate_source_map
self.live_errors = live_errors
@@ -827,7 +835,7 @@ class Compilation(object):
# If the filename begins with an http protocol
sass_path.value.startswith(('http://', 'https://')) or
# If the filename ends with .css
- sass_path.value.endswith('.css')):
+ sass_path.value.endswith(self.compiler.static_extensions)):
css_imports.append(sass_path.render(compress=False))
continue
diff --git a/scss/extension/core.py b/scss/extension/core.py
index d3cf164..227b559 100644
--- a/scss/extension/core.py
+++ b/scss/extension/core.py
@@ -41,7 +41,7 @@ class CoreExtension(Extension):
if path.suffix:
search_exts = [path.suffix]
else:
- search_exts = ['.scss', '.sass']
+ search_exts = compilation.compiler.dynamic_extensions
relative_to = path.parent
basename = path.stem
diff --git a/scss/legacy.py b/scss/legacy.py
index 1e69e65..b155330 100644
--- a/scss/legacy.py
+++ b/scss/legacy.py
@@ -83,7 +83,7 @@ class Scss(object):
def compile(
self, scss_string=None, scss_file=None, source_files=None,
super_selector=None, filename=None, is_sass=None,
- line_numbers=True):
+ line_numbers=True, import_static_css=False):
"""Compile Sass to CSS. Returns a single CSS string.
This method is DEPRECATED; see :mod:`scss.compiler` instead.
@@ -140,6 +140,7 @@ class Scss(object):
BootstrapExtension,
],
search_path=fixed_search_path,
+ import_static_css=import_static_css,
live_errors=self.live_errors,
generate_source_map=self._scss_opts.get('debug_info', False),
output_style=output_style,