forked from Dynalon/mdwiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tmpl
102 lines (90 loc) · 3.46 KB
/
index.tmpl
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html>
<!--
This is <%= grunt.config('pkg').name %> v<%= grunt.config('pkg').version %>
(C) 2013-2014 by Timo Dörr and contributors. This software is licensed
under the terms of the GNU GPLv3 with additional terms applied.
See https://github.com/Dynalon/mdwiki/blob/master/LICENSE.txt for more detail.
See http://github.com/Dynalon/mdwiki for a copy of the source code.
-->
<head>
<title>MDwiki</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="fragment" content="!">
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta charset="UTF-8">
<%
var task = grunt.config('currentTask').name;
grunt.log.writeln('Building single index.html of type: ' + task);
var ownJsFileFull = grunt.config('concat').dev.dest;
var ownJsFileMin = grunt.config('uglify').dist.dest;
var minifiedJsFiles = grunt.config('internalJsFiles');
var minifiedCssFiles = grunt.config('internalCssFiles');
function print_script_ref(ref) {
print('<script type="text/javascript" src="//' + ref + '"></script>\n');
}
function print_style_ref(ref) {
print('<link rel="stylesheet" href="//' + ref + '" type="text/css"></link>\n');
}
function print_script_inline(name, content) {
if (task === 'debug')
print('<!-- START ' + name + ' -->\n');
print('<script type="text/javascript">');
print(content);
print('</script>\n');
if (task === 'debug')
print('<!-- END ' + name + ' -->\n');
}
function print_style_inline(name, content) {
if (task === 'debug')
print('<!-- START ' + name + ' -->\n');
print('<style id="style:' + name + '">');
print(content);
print('</style>');
if (task === 'debug')
print('<!-- END ' + name + ' -->\n');
}
if (task === 'debug') {
print('<script type="text/javascript">window.MDwikiEnableDebug = true;</script>');
}
if (task === 'release') {
// INLINE SCRIPTS AND CSS
for(var i = 0, len = cssFiles.length; i < len; i++) {
var fileContent = grunt.file.read(cssFiles[i]);
print_style_inline(cssFiles[i], fileContent);
}
for(var i = 0, len = jsFiles.length; i < len; i++) {
var fileContent = grunt.file.read(jsFiles[i]);
print_script_inline(jsFiles[i], fileContent);
}
} else if (task === 'debug') {
// INLINE SCRIPTS AND CSS
for(var i = 0, len = unminifiedCssFiles.length; i < len; i++) {
var fileContent = grunt.file.read(unminifiedCssFiles[i]);
print_style_inline(unminifiedCssFiles[i], fileContent);
}
for(var i = 0, len = unminifiedJsFiles.length; i < len; i++) {
var fileContent = grunt.file.read(unminifiedJsFiles[i]);
print_script_inline(unminifiedJsFiles[i], fileContent);
}
}
// OUR OWN CODE
var fileContent = '';
if (task === 'debug') {
fileContent = grunt.file.read(ownJsFileFull);
print_script_inline(ownJsFileFull, fileContent);
} else if (task === 'release') {
fileContent = grunt.file.read(ownJsFileMin);
print_script_inline(ownJsFileMin, fileContent);
}
%>
</head>
<body>
<noscript>
This website requires Javascript to be enabled. Please turn on Javascript
and reload the page.
</noscript>
<div id="md-all">
</div>
</body>
</html>