bdkjones / Kit

The Kit Compiler, as implemented in CodeKit
77 stars 6 forks source link

Feature Request: More Flexible Handling Of THE Space In Imports #8

Open ivanreese opened 10 years ago

ivanreese commented 10 years ago

In the CodeKit help for .kit files, it says:

The syntax is flexible. You can use @include instead of @import if you prefer. Quotes and spaces are totally optional (except for the space after the @import statement; that one you need).

Cool, cool. So, I'm doing some multiple imports, because hell yes those are helpful and nice to have. And if I do them this way, it works:

<!-- @import pages/companies.kit,
    pages/people.kit,
    pages/person.kit,
    pages/tests.kit
-->

But, oh man, the parser is pretty strict. It really wants that space after the @import statement to be a SPACE. So, this cleaner, nicer-looking alternative most certainly does not work.

<!-- @import
    pages/companies.kit,
    pages/people.kit,
    pages/person.kit,
    pages/tests.kit
-->

I'm going to assume this is one of those NP Hard problems, and take my lumps. But if, on the off chance, a tiny tweak to the parser ends up in a future version that allows this, I'm going to take a video of myself doing the happy dance, and hold my phone up to the very Sun itself to show it just how happy I am.

bdkjones commented 10 years ago

I will hold you to the video promise.

Sent from my iPhone

On Oct 2, 2014, at 11:57, Ivan Reese notifications@github.com wrote:

In the CodeKit help for .kit files, it says:

The syntax is flexible. You can use @include instead of @import if you prefer. Quotes and spaces are totally optional (except for the space after the @import statement; that one you need).

Cool, cool. So, I'm doing some multiple imports, because hell yes those are helpful and nice to have. And if I do them this way, it works:

But, oh man, the parser is pretty strict. It really wants that space after the @import statement to be a SPACE. So, this cleaner, nicer-looking alternative most certainly does not work.

I'm going to assume this is one of those NP Hard problems, and take my lumps. But if, on the off chance, a tiny tweak to the parser ends up in a future version that allows this, I'm going to take a video of myself doing the happy dance, and hold my phone up to the very Sun itself to show it just how happy I am.

— Reply to this email directly or view it on GitHub.

ivanreese commented 10 years ago

Raising the stakes.... It seems that editing a .kit file which is imported into another .kit file as part of a multiple import doesn't trigger a recompile.

Eg: If I have a master file with two imports,

<!-- @import components/logo.kit -->
<!-- @import components/nav.kit -->

... then editing either of those imported files will trigger a recompile. But if I use a multiple import,

<!-- @import components/logo.kit, components/nav.kit -->

... then it seems that editing either of those two files does not trigger a recompile.

Anyway, due to this issue, I've switched to just using single-import statements rather than multiple-import statements, which also works around the original issue I was having.

But... if you do fix them, then I guess I double owe you. It's worse than that, though — you've fixed like a dozen bugs that I've reported already (I have a hunch that I was the "persistent emailer" referenced recently in your changelog) so I like dodecahedr-owe you. I'll probably have to write a song about CodeKit to go with the video of me doing the happy dance. And maybe buy a few "extra" licenses. CodeKit is saving my team hours and hours of command line pain, so.. at the very least, heartfelt thanks.