Skip to content

Commit

Permalink
Provide a fix for #300
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfr committed Aug 16, 2019
1 parent f03e4a2 commit 4903c53
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
3 changes: 0 additions & 3 deletions content/templates/_components/c-example-2/01-button-test.md

This file was deleted.

4 changes: 0 additions & 4 deletions content/templates/_components/c-example-2/02-button-test.md

This file was deleted.

12 changes: 6 additions & 6 deletions core/discovery/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ function autoHumanizedName(filename) {
let fileNameParts = filename.split("-");
let humanizedNameParts = [];
let humanizedName = '';
fileNameParts.forEach((fileNamePart) => {
// If is not a number
if(!(/^\d+$/.test(fileNamePart))) {
fileNameParts.forEach((fileNamePart, index) => {
// If is not a number and not the first file name part
if( (!(/^\d+$/.test(fileNamePart))) || !(index == 0)) {
// If is not a component category
if(Object.keys(config.styleguide.componentCategories).indexOf(fileNamePart) === -1) {
humanizedNameParts.push(fileNamePart);
}
}
})

// Final name
// Final name
humanizedName = humanizedNameParts.join(" ");
// Capitalize first letter
return humanizedName.substr(0,1).toUpperCase() + humanizedName.substr(1);
Expand All @@ -40,7 +40,7 @@ function discover() {
if (fs.existsSync(paths.content.templates.patterns)) {
console.log(chalk.white.bgRed.bold('This project still uses the old `content/templates/_patterns/` directory.\nThis directory has been renamed to `content/templates/_components/`.\nPlease rename the folder in this project.\n'));
}

if (!config.styleguide) {
return [];
}
Expand Down Expand Up @@ -118,4 +118,4 @@ function discover() {

module.exports = {
discover: discover
};
};

0 comments on commit 4903c53

Please sign in to comment.