mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 19:49:59 +08:00
update
This commit is contained in:
parent
70b0829836
commit
06a97ff5cb
26
nico.js
Normal file
26
nico.js
Normal file
@ -0,0 +1,26 @@
|
||||
var path = require('path');
|
||||
|
||||
// {{ settings for nico
|
||||
exports.theme = 'theme';
|
||||
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;
|
||||
};
|
||||
exports.writers = [
|
||||
'nico.PageWriter',
|
||||
'nico.StaticWriter',
|
||||
'nico.FileWriter'
|
||||
];
|
||||
// end settings }}
|
13
nico.json
13
nico.json
@ -1,13 +0,0 @@
|
||||
{
|
||||
"source": ".",
|
||||
"output": "_site",
|
||||
"theme": "theme",
|
||||
"sitename": "Ant Design",
|
||||
"siteurl": "",
|
||||
"permalink": "{{directory}}/{{filename}}",
|
||||
"writers": [
|
||||
"nico.PageWriter",
|
||||
"nico.FileWriter",
|
||||
"nico.StaticWriter"
|
||||
]
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run clean && nico build",
|
||||
"start": "npm run clean && nico server",
|
||||
"start": "npm run clean && nico server --watch",
|
||||
"clean": "rm -rf _site",
|
||||
"deploy": "npm run build && gh-pages -d _site -b master"
|
||||
}
|
||||
|
@ -1 +1,8 @@
|
||||
aside
|
||||
{%- set items = resource.pages|find_category(post.meta.category) %}
|
||||
<aside>
|
||||
<ul>
|
||||
{%- for item in items %}
|
||||
<li><a href="{{permalink_url(item)}}">{{item.title}}</a></li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</aside>
|
||||
|
@ -29,7 +29,7 @@
|
||||
</li>
|
||||
<li><a href="/docs/instruction">原则</a>
|
||||
</li>
|
||||
<li><a href="/docs/components">组件</a>
|
||||
<li><a href="/components/button">组件</a>
|
||||
</li>
|
||||
<li><a href="/docs/modes">模式</a>
|
||||
</li>
|
||||
@ -41,6 +41,9 @@
|
||||
</nav>
|
||||
<div class="nav-phone-icon"></div>
|
||||
</header>
|
||||
{%- if post.meta.template === 'component' %}
|
||||
{%- include "aside.html" %}
|
||||
{%- endif %}
|
||||
{%- if post.filename === 'index' %}
|
||||
<div class="main">
|
||||
<div class="main-box" id="main">
|
||||
|
@ -1,3 +1,6 @@
|
||||
module.exports = function(nico) {
|
||||
var exports = {};
|
||||
|
||||
exports.reader = function(post) {
|
||||
var filename = post.meta.filepath.toLowerCase();
|
||||
if (filename.indexOf('components') >= 0) {
|
||||
@ -9,8 +12,33 @@ exports.reader = function(post) {
|
||||
post.filename = post.meta.filename = 'index';
|
||||
post.meta.category = 'docs';
|
||||
}
|
||||
if (!post.meta.category) {
|
||||
post.meta.category = post.meta.directory;
|
||||
}
|
||||
post.meta.category = post.meta.category || post.meta.directory;
|
||||
return post;
|
||||
};
|
||||
|
||||
exports.filters = {
|
||||
find_category: function(pages, cat) {
|
||||
var ret = [];
|
||||
Object.keys(pages).forEach(function(key) {
|
||||
var item = nico.sdk.post.read(key);
|
||||
if (item.meta.category === cat) {
|
||||
ret.push(item);
|
||||
}
|
||||
});
|
||||
ret = ret.sort(function(a, b) {
|
||||
if (/index$/i.test(a.filename)) {
|
||||
a.meta.order = 1;
|
||||
}
|
||||
if (/index$/i.test(b.filename)) {
|
||||
b.meta.order = 1;
|
||||
}
|
||||
a = a.meta.order || 10;
|
||||
b = b.meta.order || 10;
|
||||
return parseInt(a, 10) - parseInt(b, 10);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user