Add dev script

This commit is contained in:
qingwei.li 2016-11-26 18:37:17 +08:00
parent e8617a8af2
commit ff9e31f0c4
4 changed files with 39 additions and 1 deletions

16
404.dev.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="/themes/vue.css">
</head>
<body>
<nav>
<a href="/">En</a>
<a href="/zh-cn">中文</a>
</nav>
<div id="app"></div>
</body>
<script src="/lib/docsify.js" data-repo="qingwei-li/docsify"></script>
</html>

View File

@ -30,5 +30,10 @@ Create `404.html` and `README.md` into `/docs`.
</html>
```
## How to contribute
- Fork it and clone!
- Run `npm i && npm run dev`
## License
MIT

14
app.js Normal file
View File

@ -0,0 +1,14 @@
var serveStatic = require('serve-static')
var http = require('http')
var fs = require('fs')
var notfound = fs.readFileSync('404.dev.html')
http.createServer(function (req, res) {
serveStatic('.')(req, res, function () {
res.writeHead(404, { 'Content-Type': 'text/html' })
res.end(notfound)
})
}).listen(3000)
console.log(`\nListening at http://localhost:3000\n`)

View File

@ -10,6 +10,7 @@
],
"scripts": {
"build": "node build/build.js",
"dev": "node app.js & nodemon --watch src themes --exec 'npm run build'",
"test": "eslint src test"
},
"repository": {
@ -30,11 +31,13 @@
"eslint": "^3.10.2",
"eslint-config-vue": "^2.0.1",
"eslint-plugin-vue": "^1.0.0",
"nodemon": "^1.11.0",
"rollup": "^0.36.3",
"rollup-plugin-buble": "^0.14.0",
"rollup-plugin-commonjs": "^5.0.5",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1"
"rollup-plugin-uglify": "^1.0.1",
"serve-static": "^1.11.1"
},
"dependencies": {
"marked": "^0.3.6",