Skip to content

Commit

Permalink
Fix incorrect source map URL with libsass
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyfedoseev committed Nov 14, 2022
1 parent a8d3007 commit e20fe50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion static_precompiler/compilers/libsass.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def compile_file(self, source_path):
try:
if self.is_sourcemap_enabled:
compiled, sourcemap = sass.compile(
filename=full_source_path, source_map_filename=sourcemap_path, include_paths=self.load_paths
filename=full_source_path,
source_map_filename=sourcemap_path,
output_filename_hint=full_output_path,
include_paths=self.load_paths,
)
else:
compile_kwargs = {}
Expand Down
5 changes: 5 additions & 0 deletions static_precompiler/tests/test_scss.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ def test_sourcemap(compiler_module, monkeypatch, tmpdir):
assert sourcemap["sources"] == ["test.scss"]
assert sourcemap["file"] == "test.css"

with open(full_output_path) as compiled_file:
assert "/*# sourceMappingURL=test.css.map */" in {
line.strip() for line in compiled_file.readlines()
}


@pytest.mark.parametrize("compiler_module", (libsass, scss))
def test_compile_source(compiler_module):
Expand Down

0 comments on commit e20fe50

Please sign in to comment.