From 04f63ba2864d423e692962d87c98742e3c336ec2 Mon Sep 17 00:00:00 2001 From: Swashata Ghosh Date: Sat, 13 Oct 2018 19:21:52 +0530 Subject: [PATCH] feat: add postcss.config.js in project template With autoprefixer, because it is indeed a dependency. --- examples/theme/postcss.config.js | 2 +- packages/scripts/src/scripts/Bootstrap.ts | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/theme/postcss.config.js b/examples/theme/postcss.config.js index b752a53c8..4f20dfe1c 100644 --- a/examples/theme/postcss.config.js +++ b/examples/theme/postcss.config.js @@ -1,4 +1,4 @@ /* eslint-disable global-require, import/no-extraneous-dependencies */ module.exports = { - plugins: [], + plugins: [require('autoprefixer')], }; diff --git a/packages/scripts/src/scripts/Bootstrap.ts b/packages/scripts/src/scripts/Bootstrap.ts index dc1fd38f5..402107637 100644 --- a/packages/scripts/src/scripts/Bootstrap.ts +++ b/packages/scripts/src/scripts/Bootstrap.ts @@ -105,7 +105,7 @@ export class Bootstrap { const projectContext = await this.initProjectConfig(); const serverContext = await this.initServerConfig(); const deps = this.configureScripts(projectContext); - this.initBrowserList(); + this.initSharedConfigFiles(); return Promise.resolve( new InitResolve('project', serverContext, projectContext, deps) ); @@ -248,13 +248,26 @@ export class Bootstrap { /** * Create a default production ready (90%+ global coverage) - * browserlistrc file for your project. + * browserlistrc file for your project and a postcss.config.js + * file. */ - private initBrowserList(): void { + private initSharedConfigFiles(): void { fs.writeFileSync( path.resolve(this.cwd, '.browserslistrc'), '> 0.25%, not dead' ); + fs.writeFileSync( + path.resolve(this.cwd, 'postcss.config.js'), + `/* eslint-disable global-require, import/no-extraneous-dependencies */ +module.exports = { + // You can add more plugins and other postcss config + // For more info see + // + // There is no need to use cssnano, webpack takes care of it! + plugins: [require('autoprefixer')], +}; +` + ); } /**