bdkjones / CodeKit2

CodeKit 2 Beta
98 stars 4 forks source link

Jade: including arbitrary files #594

Open chris-scheurle opened 8 years ago

chris-scheurle commented 8 years ago

The Jade documentation states:

Including files that are not jade just includes the raw text.

but CodeKit does not recognize suchincludes. I also tried adding those files manually by dragging them onto the Imports/Exports panel or adding their extensions to the Generic Page Extensions in the Project Settings, but none of that works either. So, I don't get automatic recompiles, when any of the source files changes. :cry:

What I'd like to suggest: please either automatically recognizeincludes of files listet in the Generic Page Extensions setting or at least allow the user to drag arbitrary files onto the Imports/Exports panel of jade source files. In both cases: please allow image files to be used for that purpose as well (the way I see it, there is no risk of infinite loops or such, since a jade source file will never compile to an image file). Or (if you still deem this potentially harmful): consider a combination of the suggestions above: allow the user to manually drag image files and files listet in the Generic Page Extensions setting onto the Imports/Exports panel.

Oh, and just to proove there is a real world use case: currently, I am trying to includebase64ed files intodata-urls and all works fine, except for the missing automatic recompiles.

bdkjones commented 8 years ago

Please post an example project with what you're trying to do.

The issue here is that CodeKit's linker (the thing that builds the tree of dependencies between files so that the app knows what to compile when a given file changes) does not consider EVERY file type when it sees an include in Jade. It looks for other Jade files. That's why adding the imported file types to the generic page extensions list does not work.

I need a sample to test with.

subhaze commented 8 years ago

It'd be cool to see things like js/css/svg/html/txt files supported. I can help setup a small test project if needed.

js/css/svg would be nice for inlining those into produced HTML, the later for items that may already be generated and would need to be converted to Jade otherwise (which I ran into in a past project when I was given html/plain-text partials to include in pages)

FWIW: I can help provide a small test project if needed.

chris-scheurle commented 8 years ago

As @bdkjones said:

Please post an example project with what you're trying to do.

I hope this is what you wanted:

:paperclip: jade-includes.zip

subhaze commented 8 years ago

The part where I said

FWIW: I can help provide a small test project if needed.

Was, if You ( @chris-scheurle ) didn't have time to provided one... seems you did!... Thanks.

bdkjones commented 8 years ago

Thanks guys. It will be a little bit before I can dig into this, but I will put it on my list.