still-ex / still

A composable Elixir static site generator
https://stillstatic.io
ISC License
252 stars 10 forks source link

HTML Preprocessor #153

Closed elinol closed 2 years ago

elinol commented 3 years ago

I'm trying to add a preprocessor in for my .html-files since they contain front matter, but they are ignored on compilation.

preprocessors: %{
    ".html" => [AddContent, EEx, Frontmatter, OutputPath, AddLayout, Save]
  }

Are .html files maybe excluded per se?

gabrielpoca commented 3 years ago

Hi! It seems to work for me. I've pushed an example here for you. The only thing I did differently is I changed the order of EEx with FrontMatter because otherwise, the variables defined in frontmatter will not be available when it runs through EEx. If you're not using variables from frontmatter, then what you did should work. Do you see any errors on the console?

elinol commented 3 years ago

Hi! After putting the html-preprocessor in default preprocessors instead of in config.exs is works out alright. Thanks for helping me out!

lawik commented 3 years ago

Wait @gabrielpoca, you mean that we should be changing the preprocessors by editing the still dependency? This case is using Still as a dep in another application.

I imagine the config :still, preprocessors key should work and that's what we aren't having luck with.

gabrielpoca commented 3 years ago

@lawik no no, you should change it in the config like we show here. @elinol I'm sorry, I took the easiest route in my example, here's a similar example in my website that uses Still

lawik commented 3 years ago

Alright, we are having some weird problems. Will keep digging.

Thanks :)

gabrielpoca commented 3 years ago

@lawik ๐Ÿ‘ let me know if I can help

lawik commented 3 years ago

Elin pinned it down. We hadn't aliased the modules in the config. This triggers not error from what I saw :D It should probably check if there is a run function defined and log an error for a bad preprocessor or something, because this is a fairly hard-to-debug failure.

frm commented 3 years ago

this is a fairly hard-to-debug failure.

Second this, saw a few other users with the same issue. The fact that we have aliased is confusing people. I'll update the docs and try to add a specific error

gabrielpoca commented 3 years ago

image Yeah, it already happened to me as well. I tried it out, and I get this error in the console, but we should push this to the error overlay.

lawik commented 3 years ago

For us it might have drowned, we had some .DS_Store errors so I might have conflated them. Sounds like good fixes :)

On Thu, May 6, 2021 at 8:41 PM Gabriel Poรงa @.***> wrote:

[image: image] https://user-images.githubusercontent.com/934580/117349023-d10a9a00-aea2-11eb-9cf2-3c965f8dc366.png Yeah, it already happened to me as well. I tried it out, and I get this error in the console, but we should push this to the error overlay.

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/still-ex/still/issues/153#issuecomment-833767379, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPBIJM2RWRCZ5EXTEPDUGLTMLPD3ANCNFSM43WPFPRQ .

gabrielpoca commented 3 years ago

Found it ๐Ÿ˜… there's a bug in the error reporting system. Those are the worst ๐Ÿ˜ญ this is what I see now that's fixed

localhost_3000_

It could be a better error, but it's an improvement. I'll open a fix