-
Notifications
You must be signed in to change notification settings - Fork 6
/
testTemplate.js
48 lines (42 loc) · 1.03 KB
/
testTemplate.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var fs = require("fs")
let saveTemplate = (svgData) => {
let template = `<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<style>
body, html{
background-color:#ccc;
margin: 0px;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
}
#lottie{
background-color:#ccc;
width:100%;
height:100%;
display:block;
overflow: hidden;
transform: translate3d(0,0,0);
/*display:none;*/
}
</style>
<script src="lottie.js"></script>
</head>
<body>
<div id="lottie">
${svgData}
</div>
</body>
</html>`
fs.writeFile('pages/test.html', template, function(err, data){
if (err) console.log(err);
console.log("Successfully Written HTML File.");
});
fs.writeFile('pages/anim.svg', svgData, function(err, data){
if (err) console.log(err);
console.log("Successfully Written SVG File.");
});
}
module.exports = saveTemplate