Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions sass.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def compile(**kwargs):
:type source_comments: :class:`bool`
:param include_paths: an optional list of paths to find ``@import``\ ed
SASS/CSS source files
:type include_paths: :class:`collections.Sequence`, :class:`str`
:type include_paths: :class:`collections.Sequence`
:param precision: optional precision for numbers. :const:`5` by default.
:type precision: :class:`int`
:param custom_functions: optional mapping of custom functions.
Expand Down Expand Up @@ -323,7 +323,7 @@ def compile(**kwargs):
:type source_map_filename: :class:`str`
:param include_paths: an optional list of paths to find ``@import``\ ed
SASS/CSS source files
:type include_paths: :class:`collections.Sequence`, :class:`str`
:type include_paths: :class:`collections.Sequence`
:param precision: optional precision for numbers. :const:`5` by default.
:type precision: :class:`int`
:param custom_functions: optional mapping of custom functions.
Expand Down Expand Up @@ -365,7 +365,7 @@ def compile(**kwargs):
:type source_comments: :class:`bool`
:param include_paths: an optional list of paths to find ``@import``\ ed
SASS/CSS source files
:type include_paths: :class:`collections.Sequence`, :class:`str`
:type include_paths: :class:`collections.Sequence`
:param precision: optional precision for numbers. :const:`5` by default.
:type precision: :class:`int`
:param custom_functions: optional mapping of custom functions.
Expand Down Expand Up @@ -556,13 +556,10 @@ def _get_file_arg(key):
source_map_filename = _get_file_arg('source_map_filename')
output_filename_hint = _get_file_arg('output_filename_hint')

include_paths = kwargs.pop('include_paths', b'') or b''
if isinstance(include_paths, collections.Sequence):
include_paths = os.pathsep.join(include_paths)
elif not isinstance(include_paths, string_types):
raise TypeError('include_paths must be a sequence of strings, or '
'a colon-separated (or semicolon-separated if '
'Windows) string, not ' + repr(include_paths))
# #208: cwd is always included in include paths
include_paths = (os.getcwd(),)
include_paths += tuple(kwargs.pop('include_paths', ()) or ())
include_paths = os.pathsep.join(include_paths)
if isinstance(include_paths, text_type):
include_paths = include_paths.encode(fs_encoding)

Expand Down
10 changes: 10 additions & 0 deletions sasstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,3 +1388,13 @@ def test_sassc_sourcemap(tmpdir):
'file': 'a.scss.css',
'mappings': 'AAAA,AAAA,EAAE,CAAC;EAAE,SAAS,EAAE,IAAS,GAAI',
}


def test_imports_from_cwd(tmpdir):
scss_dir = tmpdir.join('scss').ensure_dir()
scss_dir.join('_variables.scss').ensure()
main_scss = scss_dir.join('main.scss')
main_scss.write("@import 'scss/variables';")
with tmpdir.as_cwd():
out = sass.compile(filename=main_scss.strpath)
assert out == ''