-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.ejs
56 lines (56 loc) · 1.62 KB
/
template.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><%= projectName %></title>
<style><%- codeStyle %><%- tmplStyle %><%- processedCSS %></style>
</head>
<body>
<header>
<div class="container">
<h1 class="headline"><%= projectName %></h1>
</div>
</header>
<main>
<div class="contents">
<% maps.forEach(function (map) { %>
<section>
<% if (showCode) { %>
<div class="description"><%- map.html %></div>
<div class="code">
<pre><code class="lang-css"><%- map.rule %></code></pre>
</div>
<% } else { %>
<div class="description"><%- map.html %></div>
<% } %>
</section>
<% }) %>
</div>
<div class="sidebar">
<nav>
<h5 class="nav-title">Rule set headlines</h5>
<ul id="links" class="nav"></ul>
</nav>
</div>
</main>
<footer>
<div class="container">
<p>Generated by <a href="https://github.com/morishitter/postcss-style-guide">postcss-style-guide</a></p>
</div>
</footer>
<script>
var titles = document.querySelectorAll('h2');
var elements = '';
[].forEach.call(titles, function(title) {
var id = title.id;
var text = title.textContent;
if (id == '' || text == '') {
return
}
elements += '<li><a href="#' + id + '" class="nav-link">' + text + '<\/a><\/li>'
});
var links = document.getElementById('links');
links.innerHTML = elements;
</script>
</body>
</html>