Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

update: user can custom component name #319

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,21 @@ function assembler(done) {
fabAssemble({
logErrors: config.dev,
dest: config.dest,
buildData: {
baseurl: '..',
materials: {
components: {
name: 'Components',
items: {
button: {
name: 'Button',
notes: '<p>foo <code>bar</code></p>\n',
},
},
},
data: {},
},
},
helpers: {
// {{ default description "string of content used if description var is undefined" }}
default: function defaultFn(...args) {
Expand Down Expand Up @@ -190,6 +205,19 @@ function assembler(done) {
mod: function mod(a, b) {
return +a % +b;
},
transform: function transform() {
const { name } = this;
if (this.data && Object.keys(this.data).length !== 0 && this.data.title)
return this.data.title;
return name;
},
transformWithJson: function transformWithJson(name) {
const title = name.toLowerCase();
// eslint-disable-next-line global-require
const json = require('./src/assets/transform.json');
if (json) return json[title] ? json[title] : name;
return name;
},
},
});
done();
Expand Down
Loading