Sorry I can't dance, I'm holding on to my friend's purse

Don't you love static web sites? So easy to deploy, so intrinsically safe... On the other hand, writing all your HTML by hand, like in 1994 (before server-side includes, for example) is rather painful.

Of course there are tools like Jekyll, but they kind of force you to adopt their conventions when you write your site.

What I'd really love to do, is to write my web site using one of those nice web frameworks we have now, update the data in there using all the nice tools they provide, and then generate the static version of the site to deploy. Most the fancy "dynamic" stuff can be handled with JavaScript on the browser.

This is what wallflower does. Given a list of URL and a Plack application, it will save all those URL into a set of files, ready to be uploaded.

Some advantages to this approach:

  • works with any Plack application
  • all the data entry can be done offline, running plackup myapp.psgi (or whatever your web framework offers) on your laptop
  • no need to setup a web server to generate the data
  • no network involved: it's faster than wget -m
  • publishing is as easy as ./generate_urls | wallflower -a myapp.psgi -d output && git commit -m "Site update" && git push

The next step is to pick all the local links from the pages, to crawl the whole website from a limited set of starting points. This is on my TODO list.

Try it!

History and naming

Back in October 2010, at OSDC.fr I saw sukria's talk about Dancer. Of course I loved it. However I'm a rather shy person in regards to web sites.

I find that static web sites have a lot of advantages:

  • they are easy to setup anywhere (just upload the files)
  • they have no security issues themselves (of course the webserver may have some)
  • they don't need maintenance

A discussion started, with (as far as I remember) Marc Chantreux, Alexis Sukrieh and Franck Cuny (the great thing about Dancer devs, is that they attend conferences in France!).

We were saying:

  • Wouldn't it be great to be able to have say, a blog, written in Dancer, but entirely static?"
  • We could always deal with the comments at an external site, with clever use of JavaScript...
  • Hey, That's another great project!
  • Too bad we have so little time...

(We later found out about DISQUS)

A tool for making a static web site out of any Dancer application, that would be neat. After Alexis' talk, made with Broadway, and Franck talking about jitterbug, it was obvious we needed to make a dance-related pun.

And in fact,I knew exactly how to describe it. It was like the people at a party that do not dance, and always have a perfectly good excuse, like "Sorry I can't dance, I'm holding on to my friend's purse".

Lacking the English name for those, we still didn't have a name for the project, until Alexis popped up on the IRC channel a few days later with a link to the urban dictionary definition of wallflower. After a little time spent search on YouTube, I found the perfect example of a wallflower dance.

Because a good pun should never be wasted, a first version of the program has been included in Dancer since version 1.3000_01. Very early on, Vincent Pit remarked that (besides the name) it really had nothing to do with Dancer, and was all about Plack. This has been on the back of my mind ever since.

The App::Wallflower module is the proper, Plack-aware, version of the original program. As said in the documentation:

wallflower treats all Plack applications equally, even if the first version of the program was targetting Dancer only.

Thanks Plack, for helping us to be so inclusive.

4 Comments

Cool!

I do something like this already with ttree and a script, but being able to use your code and Plack::Middleware::TemplateToolkit would be even nicer.

One of the things about static sites is you can HOST them on Amazon's S3! (create a bucket with the same names as your domain - e.g. www.domain.com and then look in the preferences for it to activate as a hosted website.)

My hacky script for the above:

https://github.com/ranguard/Sheep-System/blob/master/s3/s3tt

I submitted a patch to s3cl script that comes with Net::Amazon::S3 for the sync_up() that's been accepted just not released to CPAN yet.

Giving the background story really adds to the whole post, in my opinion!

I didn't even know the entire story. :)

Sounds like a great bit of history, at the very least. :)

Leave a comment

About BooK

user-pic Pink.