Kronuz / pyScss

pyScss, a Scss compiler for Python
MIT License
582 stars 141 forks source link

Dots in filenames break imports #334

Closed PhilipGarnero closed 8 years ago

PhilipGarnero commented 9 years ago

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 !

PhilipGarnero commented 9 years ago

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.

Kronuz commented 9 years ago

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

PhilipGarnero commented 9 years ago

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

eevee commented 8 years ago

Fixed in 1.3.5; thanks for the PR!