hanami/assets

Compiler tries to compile .sassc file (on Linux)

Closed this issue · 7 comments

After running tests on both master and develop, I keep getting:

  1) Error:
Compiler#test_0012_compiles sass asset if a dependency is removed:
Hanami::Assets::UnknownAssetEngine: No asset engine registered for `41c7f75a-3dac-4bee-b1ed-4b09f3fe0c8e.css.sassc'
    /home/katafrakt/dev/github/hanami-assets/lib/hanami/assets/compiler.rb:192:in `rescue in compile!'
    /home/katafrakt/dev/github/hanami-assets/lib/hanami/assets/compiler.rb:190:in `compile!'
    /home/katafrakt/dev/github/hanami-assets/lib/hanami/assets/compiler.rb:132:in `compile'
    /home/katafrakt/dev/github/hanami-assets/lib/hanami/assets/compiler.rb:74:in `compile'
    /home/katafrakt/dev/github/hanami-assets/test/integration/compiler_test.rb:179:in `block (3 levels) in <top (required)>'
    /home/katafrakt/dev/github/hanami-assets/test/support/test_file.rb:25:in `touch'
    /home/katafrakt/dev/github/hanami-assets/test/integration/compiler_test.rb:178:in `block (2 levels) in <top (required)>'


  2) Error:
Compiler#test_0011_compiles sass asset if a dependency is added:
Hanami::Assets::UnknownAssetEngine: No asset engine registered for `14bf2f8f-9bd2-4782-b550-294e1eca839b.css.sassc'
    /home/katafrakt/dev/github/hanami-assets/lib/hanami/assets/compiler.rb:192:in `rescue in compile!'
    /home/katafrakt/dev/github/hanami-assets/lib/hanami/assets/compiler.rb:190:in `compile!'
    /home/katafrakt/dev/github/hanami-assets/lib/hanami/assets/compiler.rb:132:in `compile'
    /home/katafrakt/dev/github/hanami-assets/lib/hanami/assets/compiler.rb:74:in `compile'
    /home/katafrakt/dev/github/hanami-assets/test/integration/compiler_test.rb:155:in `block (3 levels) in <top (required)>'
    /home/katafrakt/dev/github/hanami-assets/test/support/test_file.rb:25:in `touch'
    /home/katafrakt/dev/github/hanami-assets/test/integration/compiler_test.rb:154:in `block (2 levels) in <top (required)>'

I managed to narrow it down to files method (https://github.com/hanami/assets/blob/master/lib/hanami/assets/config/sources.rb#L48) returning array of files formed as:

[
"/home/katafrakt/dev/github/hanami-assets/tmp/sass-cache/e0b7e4343b617a2188b0aa19dbd2153da78474d2/b2b70834-66c7-432a-96f6-c76b21f66572.css.sassc",
"/home/katafrakt/dev/github/hanami-assets/tmp/b2b70834-66c7-432a-96f6-c76b21f66572.css.sass",
"/home/katafrakt/dev/github/hanami-assets/tmp/public/assets/b2b70834-66c7-432a-96f6-c76b21f66572.css"
]

... which is obviously not the best order to take first and assume it's a good file. I took few naive attempts to fix it (e.g. by excluding path if it has sass-cache in it), but I haven't succeeded.

@katafrakt Hi. Which version are you using? This is odd because CI runs linux boxes.

I tried Hanami::Assets master and develop version.

I also thought that CI runs Linux, however it might be just coincidence or be depending on filesystem configuration. Basically, you cannot rely on order of Dir.glob results, because they might be very different on different systems.

@katafrakt Please update to use Utils::FileList than. It's build with the purpose of returning an array of file names with a consistent order across OSes.

Usage: Utils::FileList["path/to/**/*"].

@jodosha Thanks, this fixed this issue (however some other appeared, I have to investigate them). I can create a PR for this change - should it target master or develop?

@katafrakt I see, thank you. If the fix is only about the file list order, please use master.

Fixed by #75

@katafrakt thank you! 👍