From f640c80f1e583c7de0ec84c4fb0e2363fa1a96dc Mon Sep 17 00:00:00 2001 From: Brian Staruk Date: Mon, 23 Apr 2018 10:25:35 -0400 Subject: [PATCH] first pass at codeStyle options & pascalClassNames --- build/scaffold-factory.js | 8 +++++++- source/fc-config.js | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/build/scaffold-factory.js b/build/scaffold-factory.js index 0f91de4..7c338af 100644 --- a/build/scaffold-factory.js +++ b/build/scaffold-factory.js @@ -11,6 +11,12 @@ const dopl = require('dopl'); const { source } = require('./lib/path-helpers'); +const { codeStyle } = require(source('fc-config')); // eslint-disable-line + + +const getCssName = (name) => ( + codeStyle.pascalClassNames ? name : name.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase() +); const scaffoldComponent = ({ name, @@ -39,7 +45,7 @@ module.exports = ({ src, dest }) => () => { return scaffoldComponent({ name: argv.name, - cssName: argv.name.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase(), + cssName: getCssName(argv.name), src: path.resolve(__dirname, 'scaffolding', src), output: source('elements', dest, argv.name) }); diff --git a/source/fc-config.js b/source/fc-config.js index 120666e..7560ffd 100644 --- a/source/fc-config.js +++ b/source/fc-config.js @@ -84,3 +84,8 @@ module.exports.themes = [{ id: 'generic', name: 'Generic' }]; + +// define code style options +module.exports.codeStyle = { + pascalClassNames: false // set to true if scaffolding should use PascalCase class names +};