export class TemplateGenerator { static config(): string { return ` var path = require('path') module.exports = { // folder where components, patterns, and pages will be placed src: path.join(__dirname, './pattern-library'), // meta info that will be included in the api under the meta key meta: { // appears in pattern library name: 'Pops Pattern Library', // current pattern library version version: '0.1.0', // keep short as overviews should be used for more substantial info summary: 'A pattern library of Atomic components.', authors: [ // list of developers who have worked on the project 'Brian Douglas' ] }, // relative path to a template twig file which pops will use as it's pattern library template // Note: this should left as an empty string unless you want to change the pops ui template: '', // color pallette colors: [ {name: 'white', color: '#FFFFFF'}, {name: 'grey', color: '#AAAAAA'}, {name: 'black', color: '#000000'} ], // list of fonts fonts: [ {name: 'Roboto', font: 'https://fonts.googleapis.com/css?family=Roboto'} ], // file extensions that will be used // Note: if scripts or styles is an empty string they will not be generated ext: { templates: 'twig', styles: 'scss', scripts: 'js' }, // stylesheets and scripts that will be placed in pattern library head globals: { stylesheets: [ // Include stylesheets ], javascripts: [ // Include scripts ] } }`; } static doc(name: string): string { return `# ${name}`; } static item(name: string, ext: { styles: string, scripts: string, templates: string }): string { return ` var path = require('path'); var fs = require('fs'); var paths = { doc: path.join(__dirname, 'README.md'), ${ext.styles ? `style: path.join(__dirname, 'styles/${name}.${ext.styles}'),` : ''} ${ext.scripts ? `script: path.join(__dirname, 'scripts/${name}.${ext.scripts}'),` : ''} template: path.join(__dirname, '${name}.${ext.templates}') }; module.exports = { name: '${name}', paths: paths, doc: fs.readFileSync(paths.doc, 'utf8'), ${ext.styles ? `style: fs.readFileSync(paths.style, 'utf8'),` : ''} ${ext.scripts ? `script: fs.readFileSync(paths.script, 'utf8'),` : ''} template: fs.readFileSync(paths.template, 'utf8'), context: {} };`; } static page(name: string, ext: { styles: string, scripts: string, templates: string }): string { return ` var path = require('path'); var fs = require('fs'); var paths = { template: path.join(__dirname, '${name}.${ext.templates}') }; module.exports = { name: '${name}', paths: paths, template: fs.readFileSync(paths.template, 'utf8'), context: {} };`; } }