mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
nico-jsx hot reload demo box
This commit is contained in:
parent
2e839a42fa
commit
55cc3c57e4
15
nico.js
15
nico.js
@ -119,6 +119,21 @@ exports.writers = [
|
||||
'nico-jsx.StaticWriter',
|
||||
'nico-jsx.FileWriter'
|
||||
];
|
||||
|
||||
exports.watchFunc = function(e) {
|
||||
console.log('reload: ' + e.filepath);
|
||||
var post = e.post;
|
||||
if (post && post.template === 'code' && post.id) {
|
||||
var demoNode = $('#' + post.id);
|
||||
if (demoNode[0]) {
|
||||
ReactDOM.unmountComponentAtNode(demoNode[0]);
|
||||
demoNode.next().remove().insertAfter(demoNode);
|
||||
$(post.html).insertAfter(demoNode.next());
|
||||
}
|
||||
} else if (!(/\.js(x?)$/.test(post.filename))) {
|
||||
location.reload();
|
||||
}
|
||||
};
|
||||
// end settings }}
|
||||
|
||||
process.on('uncaughtException', function(err) {
|
||||
|
@ -102,7 +102,7 @@
|
||||
"less-loader": "^2.2.0",
|
||||
"lesshint-antd": "^1.2.1",
|
||||
"lodash": "^4.1.0",
|
||||
"nico-jsx": "~0.7.2",
|
||||
"nico-jsx": "~0.8.2",
|
||||
"postcss-loader": "^0.8.0",
|
||||
"pre-commit": "1.x",
|
||||
"rc-scroll-anim": "^0.1.7",
|
||||
@ -123,7 +123,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"babel": "babel components index.js --out-dir lib",
|
||||
"start": "npm run clean && nico server",
|
||||
"start": "npm run clean && nico server --watch",
|
||||
"clean": "rm -rf _site dist",
|
||||
"site": "npm run clean && webpack --config webpack.deploy.config.js && webpack --config webpack.antd.config.js && NODE_ENV=PRODUCTION nico build",
|
||||
"deploy": "rm -rf node_modules && node scripts/install.js && npm run just-deploy",
|
||||
|
Loading…
Reference in New Issue
Block a user