Still - A composable static site builder

Hello everyone!

I want to share with you something that I’m really proud of: https://stillstatic.io/

Still is a static site builder for Elixir! Do you need to build a static website? This is what you want! We wanted to take a step back from the complications of building websites nowadays and have something simple and that just works, but that you can extend and grow in complexity if you need. Here are a few highlights:

  • Throw some HTML, Slime, Markdown, CSS, JS, and images into a folder, and it will just work.
  • Out of the box, it works with Slime and Markdown, but you can use EEx almost anywhere, such as in CSS, JS, or HTML files.
  • There’s a development server that watches the file system and refreshes the browser when necessary.
  • There’s an error overlay in the browser where you can see errors, the stacktrace, and more information on the context that leads to that error.
  • There are helper functions to generate links and responsive images, to include other files, etc.
  • We just finished an integration with Snowpack GitHub - still-ex/still_snowpack: Snowpack integration for Still, which means that you can use tools like TailwindCSS or any other NPM package.

As far as I know, there isn’t anything like it. The idea is to keep it small but add enough functionality to allow anyone to build a modern website without having to reach for something more.

There are already a few people using it, but we would welcome contributors and users to improve it further!
Also, if you check out the website, I hope you enjoy the posters :slight_smile:https://stillstatic.io/

45 Likes

Hi,

This looks very promising. I never tried Still but I’ve heard really good thing about it, I’ll try it for my next static website :slight_smile:

Thank you for contributing!

3 Likes

The page itself looks great (the posters too). I have searched before for a static site generator in elixir, great to see it.
I haven’t had time to check it through, only a superficial reading, does this work only as a static generator, or can you use it as phoenix app if you wanted to?
(because I have in my “backlog” the idea of having a phoenix app, that could spit a static website if wanted, but then could just be a normal app if the need ever comes, like nuxt does for instance)

1 Like

Or the other way around: a static site that seamlessly integrated with a phoenix site, all built from the same source repo.

1 Like

But I think that in that case it either it would have to be served as static assets, probably with some catch all route that forwarded to a router that would sit beneath the normal routes - but here you would basically loose the ability to “seamlessly” integrate other parts of phoenix, like having assigns, small helper/partial templates and such, or it would probably be quite difficult to glue it together into an existing static file in case you wanted those? I might also be misunderstanding what you envision.

1 Like

I don’t have a grand vision of how to achieve this, but right now there is a disconnect between a static site (for the content web) and a dynamic site (for the application web). In many cases, the application web need to serve static contents, such as documentation, and the content web need to serve dynamic contents, like forum, e-commerce, etc. If there is a way to blend the 2 together seamlessly and use the best tool for the task, both the user experience and the development effort can be greatly improved.

3 Likes

I don’t know exactly what the integration with Pheonix would look like, but it’s something that’s on my mind, and I think there’s even an open issue for it. You can install Still in the app where you have Phoenix and compile the website priv/static during the build step of your deployment. Or you can compile it to anywhere in priv and use rules such as the ones we have the dev server to serve those assets. With that in place, I guess you can call anything from the templates. You could make queries to Ecto or something like that. I need to try this out.

6 Likes

This looks superb! Good luck with it!

If I could offer another project for inspiration, I love “pmwiki” and the way they have made the whole thing function by pages including other pages, and the use of metadata/variables that can be attached to each page. So it’s trivial to add a header section to a group of pages by just optionally creating another page which is only included if it exists. Breadcrumbs/prev/next links can be added by scanning metadata, or by examining content on an index page. A built in search feature can have its output fed through a formatter to do cool things like creating a blog index page, or a sidebar showing x latest posts, or y latest events, etc.

There is a point where stuff starts to get tricky with all site generators and you need to start coding. I think they did a great job of making it really trivial to introduce new features with very little code, often just through conditional insertion of pages, or torturing the search function, etc

Good luck with this!

2 Likes

It would be really fantastic if you could somehow have it be a runtime: false dependency so it does all the compiling at comptime and drops it into priv/static with an appropriate router module.

4 Likes

I was not aware of this nice Slime template engine:

It seems that it’s inspired in Slim from Ruby and looks like a very clean template engine… need to give it a try :slight_smile:

That’s the idea and I believe it’s already possible. I need to try it out and document the process. You would run mix still.compile like you run mix phx.digest.

1 Like

Yeah, it makes writing templates a lot easier. There’s also and issue to add support for temple GitHub - mhanberg/temple: An HTML DSL for Elixir and Phoenix which I didn’t know of until a couple of weeks ago but looks awesome

3 Likes

wow, temple is beautiful. I would love to write a server-side virtual-dom thing using the temple DSL, but I don’t have the time :sob:

2 Likes

Any plans for theme support? The thing that keeps me on Jekyll is there are a ton of drop-in themes.

1 Like

I had no idea that Jekyll had those, and I love the idea: hex packages are just themes for Still sounds great. I can think of a couple of ways to make it work, and I think that as we move forward, we’ll reach a point where adding that will be straightforward. But I’m not there yet, so I don’t think support for themes will be coming any time soon unless someone else picks it up.

1 Like

Hugo Static Site generator also have tons of them:

Let’s hope that some gets interested in adding support for themes, because they are important to get Still to the place it deserves :slight_smile:

1 Like

Hello!
There isn’t a new version out yet, but I thought it could be interesting to write an update. We addressed some minor bugs and did some small refactors these past weeks, and there’s a huge change coming soon. If you tried Still, you might have noticed that if you’re calling Elixir modules in the templates (HTML, EEx, Slime, etc), they are not recompiled automatically. So when you change your Elixir module, you had to run “recompile” in iex and then “touch” the template to recompile the page. This experience wasn’t good, and the plan was to have something like what you get in Phoenix, where the Elixir code is recompiled automatically with the request.

All of this lead to a huge change that’s ongoing in this PR. If you know about how Phoenix does this recompilation mechanism, your input would be valuable. For now, we just copied the minimum amount of code from Pheonix’s implementation, but something may be missing.

3 Likes

I love the Broadway cinema style website!

4 Likes

Hello everyone!
Version 0.6.0 with all of the changes I mentioned above:

  • everything is faster.
  • templates are recompiled on refresh.
  • the elixir code is also recompiled on refresh.
  • better error handling.
  • better configs.

For the following version, we’ll be improving the docs and the examples. It would also be nice to have pre-compiled the templates as Phoenix does, but we need to check if that makes sense in Still, I feel that it doesn’t because we combine soo much stuff for a single template.

Any feedback and bug reports are much welcome!

6 Likes

Excellent progress!

1 Like