Kronuz/pyScss

Dots in filenames break imports

Closed this issue · 4 comments

Hello !
I noticed that dots in filename break the import system.
I tracked the issue down to these lines.
The problem here is that when a dot is present in the name (coming from the import statement),
doing search_exts = [path.suffix] will consider anything after the dot an extension
and basename = path.stem will take everything before as the real filename.

A little example:
For this import: @import "owl-carousel.animate", search_exts will be set to ["animate"] and the basename to "owl-carousel".
This will break the path search as it will search for search_path/owl-carousel.animate or search_path/_owl-carousel.animate where in reality it is search_path/owl-carousel.animate.scss.

I know I could just rename my files but it is working using libsass.

Thank you anyway for your efforts !

Changing this to

        search_exts = list(compilation.compiler.dynamic_extensions)
        if path.suffix and path.suffix in search_exts:
            basename = path.stem
        else:
            basename = path.name

fixed it for me.

Could you please add a test and a pull request for this one?

Sure ! I managed to run the test suite but where should I put my tests ? Are there any tests already testing imports ?

eevee commented

Fixed in 1.3.5; thanks for the PR!