top | item 7429371

Show HN: A dead simple static site generator – just two template tags

94 points| colevscode | 12 years ago |tags.brace.io

76 comments

order
[+] kurrent|12 years ago|reply
I'm not being facetious, but this "yet another static site generator" joins the list with 230+ other generators.

(see http://staticsitegenerators.net/)

Why do we need another one?

[+] jedberg|12 years ago|reply
Static site generators are the new Fibonacci generator. When you learn a language it's a fun little exercise, and possibly even useful.

Also, everyone has slightly different requirements, so everyone likes to build their own.

I will most likely soon build my own static site generator, because none of the ones out there do exactly what I want. I will most likely borrow from at least a few of the examples out there and then post it on my github so there is yet another one.

I think we're seeing a proliferation simply because it is so easy to share code these days. Imagine how many Fibonacci generators would have been out there if it were as easy to share code when those were popular (I want to say 10 years ago but maybe it was longer).

[+] bmj|12 years ago|reply
I've been looking at some of the options on that website, and this one seems to be less complex than many of the tools there. This isn't meant to be a blogging tool, but rather a simple way of emulating server-side includes or basic PHP includes in static HTML. I'm sure a few of those exist in that list, but when has "somebody built that already" become a gate for writing code?
[+] workhere-io|12 years ago|reply
Why do we need another one?

Because this one is much simpler to use than Jekyll and doesn't require you to install Ruby.

[+] bryanlarsen|12 years ago|reply
You could use server side includes instead, which have been a feature of web servers for about 20 years now...
[+] icebraining|12 years ago|reply
Not if you host on S3, for example.
[+] oneeyedpigeon|12 years ago|reply
A fine line, but static pages will be slightly faster than SSI.

Edit: Although what would be really nice would be the same kind of pre-processor that works with apache ssi directives

[+] steve_barham|12 years ago|reply
Not Invented Here syndrome, at all? Sure, I understand wanting to use Python for templates rather than relying on an external application. But why ignore the many, many existing template libraries? Some of those libraries have solved problems which you don't realise you have yet.

Case in point, are you planning to support this 'dead simple' template language for users of your hosting site? If so, what happens if I try to include something outside the site root, in a Dropbox area which I control? https://github.com/braceio/tags/blob/master/tags/tags.py#L13

[+] colevscode|12 years ago|reply
Fair point. Python was chosen because it's an accessible language for new programmers. As for template languages, most are very complex. We wanted something minimal.

As for that case, it won't work and we'll try to help you reorganize your content so it does. :)

[+] laurent123456|12 years ago|reply
I've been using PHP to generate static HTML pages. It's usually as simple as `php somepage.php > somepage.html` and you have all the advantages of a full featured language.
[+] tghw|12 years ago|reply
[+] colevscode|12 years ago|reply
We totally agree, and use pip and virtual envs for everything.

However we chose python, and easy_install because it's pre-installed all macbooks going back to snow leopard. (specifically python 2.6.1 which comes with distutils needed for our setup.py file) This means for many web designers, brace-tags doesn't require that you update your python install, or really know python at all. It's the simplest command line install experience we could come up with.

[+] sillysaurus3|12 years ago|reply
I wonder when pip will be considered old and outdated?
[+] newaccountfool|12 years ago|reply
What's the reason for this? Why don't you just build the website using standard HTML? Genuine question.
[+] mikegioia|12 years ago|reply
This allows you to include other html files from within your templates. Instead of writing out the same <nav> and <header> html in every single file, you can just `include 'nav.html'`
[+] CJefferson|12 years ago|reply
I was looking for something exactly like this just recently. Usually I use just php include when I want to just links some files together, but felt like I should stop using php as a preprocessor if possible.

However, everything else is so complicated if all you want is simple file inclusion.

[+] mokkol|12 years ago|reply
partials :-)

try to have 1 header in like 10 pages. That is a lot of copy pasting :-)

[+] dangayle|12 years ago|reply
I like this very much. I used to do very similar with PHP, but I'm now a Python dev. Sometimes, just sometimes, writing plain old simple html is easier, and having a basic include would save a ton of heartache for maintenance.
[+] epsylon|12 years ago|reply
I'm willing to bet that it took more time to write and setup the homepage than to write the generator itself.
[+] Kiro|12 years ago|reply
I haven't read everything but why isn't the source like 10 lines if that's all it does?
[+] icebraining|12 years ago|reply
Reading the source, it also has a built-in web server (based on Python's SimpleHTTPServer) and a file watcher to automatically rebuild the site.
[+] iagooar|12 years ago|reply
Easy to use does not have anything to do with the underlying codebase.
[+] workhere-io|12 years ago|reply
Is there any way you could make the watch feature not dependant on watchdog? The watchdog installation fails on pip on Mac. I then had to install Homebrew just to be able to install libyaml, which then meant I could install watchdog.
[+] xixixao|12 years ago|reply
Which is why this should have been written in Node. Seriously, Python/Ruby environments+package managers are the abomination of programmer's time.
[+] rooodini|12 years ago|reply
I actually found the “Highlight this” example at the top a bit confusing. Could you write “Display this” instead? Or give a better example to demonstrate conditionals?
[+] LouisSayers|12 years ago|reply
I like it! Great concept, thanks for simplifying something that should be dead easy and simple. A ruby port would be nice.