Skip to content

Commit

Permalink
feat: add postcss.config.js in project template
Browse files Browse the repository at this point in the history
With autoprefixer, because it is indeed a dependency.
  • Loading branch information
swashata committed Oct 13, 2018
1 parent a9bfc0e commit 04f63ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/theme/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable global-require, import/no-extraneous-dependencies */
module.exports = {
plugins: [],
plugins: [require('autoprefixer')],
};
19 changes: 16 additions & 3 deletions packages/scripts/src/scripts/Bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down Expand Up @@ -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
// <https://github.com/postcss/postcss-loader#configuration>
// There is no need to use cssnano, webpack takes care of it!
plugins: [require('autoprefixer')],
};
`
);
}

/**
Expand Down

0 comments on commit 04f63ba

Please sign in to comment.