Can anyone point me to a modular static HTML authoring/preprocessing framework, a la SASS? Or more accurately, HAML with includes?

StackOverflow https://stackoverflow.com//questions/12664040

  •  11-12-2019
  •  | 
  •  

Question

I find myself doing a lot of work here and there (both for myself and on contract) to develop small, static websites where the use of dynamic tools like PHP frameworks or Rails would be totally useless and heavy-handed and a waste of resources.

I'm looking for a way to author static HTML sites that introduces a level of modularity and syntax simplification; to clarify, something like SASS for HTML with a fast syntax and that allows common patterns to be extruded out in to separate files.

I'm aware of HAML. I would love for HAML to be my solution. But in all of my reading, HAML doesn't seem to have an equivalent to a SASS-style include directive used for in-lining the content of external files. In addition, HAML seems to bill itself as more of a templating engine than an authoring tool the way SASS bills itself; it seems to have a desire to be a replacement for ERB and to be used in Rails projects, rather than being used as a modular HTML preprocessor.

I know I could roll my own solution by bolting a small amount of Ruby and in-line evaluation on to HAML, but it feels a little cheap and dirty since this isn't really what HAML "wants" to do. It's not a solution I'm averse to, but if there is a no-configuration, light-weight option out there that basically behaves like SASS but for HTML then I'd prefer to go that route.

Was it helpful?

Solution

It sounds like Stasis would fit your needs very well. I've used it to build a number of small static sites now.

OTHER TIPS

We build static sites with middleman. There are a lot of features, but mainly it's just a very handy static site generator (for development and production). As a plus middleman is a quite popular thing.

And another known option is a Serve. It may be useful for rails prototypes or for those people, who already familiar with rails.

But I still prefer middleman because it's more popular (Serve just more younger, not worse).

As about your question: in both tools you can split HAML views into partials, layouts, etc.

Also, take a look at this category.

Another option is Jekyll. It offers an easy setup, easy syntax, plugins and extras.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top