# Sage for static html coders

**URL:** https://discourse.roots.io/t/sage-for-static-html-coders/6574
**Category:** sage
**Created:** 2016-04-26T17:46:33Z
**Posts:** 5

## Post 1 by @asuh — 2016-04-26T17:46:33Z

I’ve had projects in the last year or so that I wasn’t using WordPress but I love the Sage workflow so I took Sage and broke it out of the confines of WordPress. I named it [Sage Starter](https://github.com/asuh/sage-starter) for static HTML coding.

It should be up to date with Sage’s current version, I have also updated the packages to current versions and probably needs a little more loving to get rid of unneeded code for WordPress as well as getting rid of old Git commits but I plan on keeping it around for a while since it’s a great resource.

I’ve added support for [SVG](https://github.com/w0rm/gulp-svgstore) and [Critical CSS](https://github.com/addyosmani/critical) as well, although Critical needs a little work.

Please feel free to contribute if you have any updates that should be made. I’ve tested as much as I can to make it work right.

---

## Post 2 by @geodee — 2016-04-29T16:28:57Z

I like that idea—I did [a similar thing myself](http://github.com/geodee/selfsaged). I like that you’ve added SVG and Critical CSS, and how it’s up-to-date with Sage. Mine is not, but I added a PHP server that usually works. I’m looking forward to trying yours out, and I hope I can contribute!

---

## Post 3 by @vitaligent — 2016-04-29T21:09:59Z

I’ve been toying this this idea for a while now. What if I added Handlebars.js or other templating in order to break a design into components?

---

## Post 4 by @asuh — 2016-05-02T06:16:50Z

I hadn’t considered adding templating into this so that I can keep it agnostic.

EDIT: That said, @vitaligent, I’d be interested to see a fork of the repo with your implementation of Handlebars.js. I do like the idea and maybe it could live in another branch off the main?

EDIT 5/5: In doing some research on Handlebars.js, it’s completely client-side scripting which in a dev environment doesn’t really worry me. I really like that it’s 100% javascript based, that’s great b/c no additional languages need to be installed. But, considering we’re already running on top of Node.js, I think it would make just as much sense to either use server-side templating in case javascript is limited or slow, or couple this with some server-side templating using Node.js. I just don’t know what direction would be good to go. I think this is a big reason I didn’t consider templating to begin with.

---

## Post 5 by @paul_tibbetts — 2016-05-06T15:00:26Z

I’ve been using a toolkit generator called [Fabricator](http://fbrctr.github.io/) to do something similar to this, it uses handlebars for templating before it builds static pages in case you wanted to check out their implementation.

It means I can write a “theme wrapper” :

```
<!--views/layouts/page.html-->
<!doctype html>
<html lang="">
<head>

    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>{{title}}</title>

    {{#if fabricator}}<link rel="stylesheet" href="{{baseurl}}/assets/fabricator/styles/f.css">{{/if}}

    <!-- toolkit styles -->
    <link rel="stylesheet" href="{{baseurl}}/assets/toolkit/styles/toolkit.css">
    <!-- /toolkit styles -->

</head>
<body>

    {{#if fabricator}}
        {{> f-icons}}
        {{> f-menu}}
        <div class="f-container">
            {{> f-control-bar}}
    {{/if}}

    <div class="l-container">
        {{> header }}
            <main>
                {% body %}
            </main>
        {{> footer }}
    </div>

    {{#if fabricator}}
        </div>
    <script src="{{baseurl}}/assets/fabricator/scripts/f.js"></script>
    {{/if}}

    <!-- toolkit scripts -->
    <script src="{{baseurl}}/assets/toolkit/scripts/toolkit.js"></script>
    <!-- /toolkit scripts -->

</body>
</html>
```

and then write pages like this:

```
---
layout: page
---

<div class="l-container u-py">

  <h1>
    Meet us in person and see the quality of our products. <br>
    We'll be exhibiting at the following locations.
  </h1>

  <div class="c-Exhibitions">
    <ul class="c-Exhibitions-list">
      {{#each toolkit.exhibitions}}
        <li class="c-Exhibition">
	  <div class="c-Exhibition-details">
	    <h2 class="c-Exhibition-name">
	      {{this.name}}
	    </h2>
	    <span class="c-Exhibition-address">
	      {{this.location}}
	    </span>
	    <time class="c-Exhibition-date">
	      {{this.date}}
	    </time>
	  </div>
	  <div class="c-Exhibition-buttons">
	    {{> buttons.secondary text="Visit website" }}
	    {{> buttons.secondary text="Add to calendar" }}
	  </div>
        </li>
      {{/each}}
    </ul>
  </div>

</div>
```

where `toolkit.exhibitions` is a `YAML` file called `toolkit.yml` containing:

```
exhibitions:
  one:
    name: "Welsh Dental Hospital Meeting"
    location: "The Vale Hotel, Gold and Spa Resort, Cardiff, CF72 8JY"
    date: "Thursday 17th March - Friday 18th March 2016"
  two:
    name: "British Association of Spinal Surgeons"
    location: "Bath"
    date: "Wednesday 16th March - Friday 18th March 2016"
  three:
    name: "British Scoliosis Society"
    location: "Sheffield"
    date: "Tuesday 26th April - Wednesday 27th April 2016"
  four:
    name: "SBNS Meeting"
    location: "Southampton"
    date: "Wednesday 27th April - Friday 29th April 2016"
  five:
    name: "West Midlands Plastic Surgery Meeting"
    location: "Bourneville"
    date: "Saturday 10th September 2016"
```
