2015-05-09 17:36:15 +08:00
|
|
|
var path = require('path');
|
2015-06-04 14:42:24 +08:00
|
|
|
var package = require('./package');
|
2015-06-16 16:31:37 +08:00
|
|
|
var webpack = require('webpack');
|
|
|
|
var webpackMiddleware = require('webpack-dev-middleware');
|
|
|
|
var webpackConfig = require('./webpack.config');
|
|
|
|
var webpackCompiler = webpack(webpackConfig);
|
2015-06-16 20:19:15 +08:00
|
|
|
var handler;
|
2015-05-09 17:36:15 +08:00
|
|
|
|
|
|
|
// {{ settings for nico
|
2015-05-12 17:50:03 +08:00
|
|
|
exports.site = {
|
2015-06-04 14:42:24 +08:00
|
|
|
name: package.title,
|
2015-06-05 15:02:39 +08:00
|
|
|
description: package.description,
|
|
|
|
repo: package.repository.url,
|
|
|
|
issues: package.bugs.url
|
2015-05-12 17:50:03 +08:00
|
|
|
};
|
2015-06-09 15:50:36 +08:00
|
|
|
exports.theme = 'site';
|
2015-05-09 17:36:15 +08:00
|
|
|
exports.source = process.cwd();
|
|
|
|
exports.output = path.join(process.cwd(), '_site');
|
|
|
|
exports.permalink = '{{directory}}/{{filename}}';
|
|
|
|
exports.ignorefilter = function(filepath, subdir) {
|
|
|
|
var extname = path.extname(filepath);
|
|
|
|
if (extname === '.tmp' || extname === '.bak') {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (/\.DS_Store/.test(filepath)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (/^(_site|_theme|node_modules|\.idea)/.test(subdir)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
};
|
2015-06-16 16:31:37 +08:00
|
|
|
exports.middlewares = [{
|
|
|
|
name: 'webpackDevMiddleware',
|
2015-06-16 20:10:30 +08:00
|
|
|
filter: /antd\.(js|css)(\.map)?$/,
|
2015-06-16 20:19:15 +08:00
|
|
|
handle: function(req, res, next) {
|
|
|
|
handler = handler || webpackMiddleware(webpackCompiler, {
|
|
|
|
publicPath: '/dist/',
|
|
|
|
lazy: false,
|
2015-06-17 19:55:28 +08:00
|
|
|
watchDelay: 300,
|
2015-06-17 11:04:48 +08:00
|
|
|
stats: {
|
|
|
|
hash: false,
|
|
|
|
cached: false,
|
|
|
|
cachedAssets: false,
|
|
|
|
colors: true
|
|
|
|
}
|
2015-06-16 20:19:15 +08:00
|
|
|
});
|
2015-06-17 20:44:24 +08:00
|
|
|
try {
|
|
|
|
return handler(req, res, next);
|
|
|
|
} catch(e) {}
|
2015-06-16 20:19:15 +08:00
|
|
|
}
|
2015-06-16 16:31:37 +08:00
|
|
|
}];
|
2015-05-09 17:36:15 +08:00
|
|
|
exports.writers = [
|
2015-05-18 18:13:16 +08:00
|
|
|
'nico-jsx.PageWriter',
|
|
|
|
'nico-jsx.StaticWriter',
|
|
|
|
'nico-jsx.FileWriter'
|
2015-05-09 17:36:15 +08:00
|
|
|
];
|
|
|
|
// end settings }}
|