ant-design/nico.js

63 lines
1.5 KiB
JavaScript
Raw Normal View History

2015-05-09 17:36:15 +08:00
var path = require('path');
2015-06-04 14:42:24 +08:00
var package = require('./package');
var webpack = require('webpack');
var webpackMiddleware = require('webpack-dev-middleware');
var webpackConfig = require('./webpack.config');
var webpackCompiler = webpack(webpackConfig);
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-07-04 16:20:50 +08:00
exports.package = package;
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;
}
2015-07-05 23:43:05 +08:00
if (/^(_site|_theme|node_modules|site|\.idea)/.test(subdir)) {
2015-05-09 17:36:15 +08:00
return false;
}
return true;
};
exports.middlewares = [{
name: 'webpackDevMiddleware',
2015-07-04 16:20:50 +08:00
filter: /\.(js|css)(\.map)?$/,
handle: function(req, res, next) {
handler = handler || webpackMiddleware(webpackCompiler, {
publicPath: '/dist/',
2015-07-06 15:12:11 +08:00
lazy: true,
2015-06-17 11:04:48 +08:00
stats: {
hash: false,
cached: false,
cachedAssets: false,
colors: true
}
});
2015-06-17 20:44:24 +08:00
try {
return handler(req, res, next);
} catch(e) {}
}
}];
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 }}
process.on('uncaughtException', function(err) {
console.log(err);
});