ac-bundle-module-html-index
v0.0.3
Published
html-index.js: A module bundled by ac-bundle-module.
Downloads
3
Maintainers
Readme
html-index.js
A module for ac-bundle-app, published by ac-bundle-module.
Available Methods:
ignore
.DS_Store,CNAME,404.html
list
function(path) {
var list = fs.readdirSync(path);
if (list.length > 0) {
var html = `<ul>`;
for (var i=0; i<=list.length-1; i++) {
var file = list[i];
if (mod.ignore.indexOf(file) < 0) {
html += `<li><div class="label"><div class="caret">▲</div><a href="` + path.substr(1, 99999) + `/` + file +`">` + file + `</a></div>`;
var stat = fs.lstatSync(path + "/" + file);
if (stat.isDirectory()) {
html += mod.list(path + "/" + file);
}
html += "</li>";
}
}
html += "</ul>";
return html;
}
return "";
}
start
function() {
var html = `<!DOCTYPE html>
<html>
<head>
<title>` + process.cwd().split("/").pop() + `</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
` + mod.list(".") + `
</body>
<script type="text/javascript" src="script.js"></script>
</html>
`;
fs.writeFileSync("./index.html", html, "utf8");
}
Happy Coding!