forked from baukh789/GridManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
baukh789
committed
Mar 10, 2017
1 parent
4ceeb76
commit 868bc21
Showing
6 changed files
with
97 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
###新增 | ||
- 鼠标hove状态时,行列同时高亮 | ||
- React框架下渲染示例 | ||
- Angular框架下渲染示例 | ||
|
||
###变更 | ||
- 废弃参数: useDefaultStyle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,32 @@ | ||
var http = require("http"), | ||
url = require("url"), | ||
path = require("path"), | ||
fs = require("fs"); | ||
var express = require('express'); | ||
var app = express(); | ||
var path = require('path'); | ||
var url = require('url'); | ||
var webpack = require('webpack'); | ||
var config = require('./webpack-dev-config'); | ||
var compiler = webpack(config); | ||
|
||
http.createServer(function (req, res) { | ||
var pathname=__dirname + url.parse(req.url).pathname; | ||
if (path.extname(pathname)=="") { | ||
pathname+="/"; | ||
} | ||
if (pathname.charAt(pathname.length-1)=="/"){ | ||
pathname+="index.html"; | ||
} | ||
fs.exists(pathname,function(exists){ | ||
if(exists){ | ||
switch(path.extname(pathname)){ | ||
case ".html": | ||
res.writeHead(200, {"Content-Type": "text/html"}); | ||
break; | ||
case ".js": | ||
res.writeHead(200, {"Content-Type": "text/javascript"}); | ||
break; | ||
case ".css": | ||
res.writeHead(200, {"Content-Type": "text/css"}); | ||
break; | ||
case ".gif": | ||
res.writeHead(200, {"Content-Type": "image/gif"}); | ||
break; | ||
case ".jpg": | ||
res.writeHead(200, {"Content-Type": "image/jpeg"}); | ||
break; | ||
case ".png": | ||
res.writeHead(200, {"Content-Type": "image/png"}); | ||
break; | ||
default: | ||
res.writeHead(200, {"Content-Type": "application/octet-stream"}); | ||
} | ||
// 是否为开发模式; true: 使用src下的资源, false: 使用build下的资源 | ||
var isDev = true; | ||
var target = 'build'; | ||
if(isDev){ | ||
target = 'src'; | ||
} | ||
app.use(require('webpack-dev-middleware')(compiler, { | ||
noInfo: false, | ||
stats: { | ||
colors: true, | ||
cached: false | ||
}, | ||
publicPath: config.output.publicPath | ||
})); | ||
|
||
fs.readFile(pathname,function (err,data){ | ||
res.end(data); | ||
}); | ||
} else { | ||
res.writeHead(404, {"Content-Type": "text/html"}); | ||
res.end("<h1>404 Not Found</h1>"); | ||
} | ||
}); | ||
|
||
}).listen(1987); | ||
|
||
console.log("Server running at http://127.0.0.1:1987/"); | ||
// 配置资源路径 | ||
app.use(express.static(target)); | ||
app.listen(1987, function (err) { | ||
if (err) { | ||
console.log(err); | ||
return; | ||
} | ||
console.log('started at http://localhost:1987'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
var webpack = require('webpack'); | ||
var path = require('path'); | ||
var TransferWebpackPlugin = require('transfer-webpack-plugin'); | ||
var buildPath = path.resolve(__dirname, "build"); | ||
var config = { | ||
//入口文件配置 | ||
entry:path.resolve(__dirname, 'src/js/GridManager.js'), | ||
resolve:{ | ||
extentions:["","js"]//当requrie的模块找不到时,添加这些后缀 | ||
}, | ||
//文件导出的配置 | ||
output:{ | ||
path: buildPath , | ||
filename: "js/GridManager.js", | ||
publicPath: "/" | ||
}, | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin({ | ||
include: /\.min\.js$/, | ||
// mangle: false, | ||
minimize: true, | ||
warnings: false | ||
}), | ||
new TransferWebpackPlugin([ | ||
{from: __dirname + '/src/fonts', to: '/fonts'}, | ||
{from: __dirname + '/src/css', to: '/css'}, | ||
{from: __dirname + '/src/demo', to: '/demo'}, | ||
{from: __dirname + '/version', to: '/version'} | ||
]) | ||
], | ||
module: { | ||
preLoaders: [ | ||
{ | ||
test: /\.(js|jsx)$/, | ||
loader: 'eslint-loader', | ||
include: [path.resolve(__dirname, "src/app")], | ||
exclude: /(node_modules|bower_components)/ | ||
} | ||
], | ||
loaders: [ | ||
{ | ||
test: /\.js?$/, | ||
loaders: ['babel?{"presets":["es2015"]}'], | ||
exclude: /(node_modules|bower_components)/, | ||
include: [path.join(__dirname, 'src')] | ||
}, | ||
{ | ||
test:/\.css$/, | ||
loader:'style!css', | ||
exclude: /(node_modules|bower_components)/, | ||
include: [path.join(__dirname, 'src')] | ||
} | ||
] | ||
} | ||
}; | ||
|
||
module.exports = config; |