-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathfile-list-gen.js
33 lines (29 loc) · 1.02 KB
/
file-list-gen.js
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
const fs = require('fs')
const shell = require('shelljs')
const config = require('./motley.config.json')
const fileListViews = shell.find('examples/views')
.filter((file) => file.match(/\.hbs$/))
.sort()
.map(hbsFileName => {
let fileName = hbsFileName.replace(".hbs", "")
fileName = fileName.split("/").pop()
return `<div class="py-2 px-4 text-ellipses"><a target="preview" class="font-sm" href="${fileName}.html">${fileName}</a></div>`
})
.join('\n')
html = `
{{> nav-bar }}
<div class="home-vh">
<div class="row no-gutters">
<div class="col-sm-3 pb-4 position-relative border-right" style="height: calc(100vh - 70px); overflow-y: scroll">
<h2 class="position-sticky bg-white p-4 tr">Views</h2>
${fileListViews}
</div>
<div class="col-sm-9 p-4">
<h2 class="mb-4">Preview</h2>
<div class="border">
<iframe style="width: 100%; height: calc(100vh - 175px)" name="preview" frameborder="0"></iframe>
</div>
</div>
</div>
</div>`
fs.writeFile(__dirname + '/examples/views/index.hbs', html, () => null)