Skip to content

Commit 04f63ba

Browse files
committed
feat: add postcss.config.js in project template
With autoprefixer, because it is indeed a dependency.
1 parent a9bfc0e commit 04f63ba

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

examples/theme/postcss.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/* eslint-disable global-require, import/no-extraneous-dependencies */
22
module.exports = {
3-
plugins: [],
3+
plugins: [require('autoprefixer')],
44
};

packages/scripts/src/scripts/Bootstrap.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class Bootstrap {
105105
const projectContext = await this.initProjectConfig();
106106
const serverContext = await this.initServerConfig();
107107
const deps = this.configureScripts(projectContext);
108-
this.initBrowserList();
108+
this.initSharedConfigFiles();
109109
return Promise.resolve(
110110
new InitResolve('project', serverContext, projectContext, deps)
111111
);
@@ -248,13 +248,26 @@ export class Bootstrap {
248248

249249
/**
250250
* Create a default production ready (90%+ global coverage)
251-
* browserlistrc file for your project.
251+
* browserlistrc file for your project and a postcss.config.js
252+
* file.
252253
*/
253-
private initBrowserList(): void {
254+
private initSharedConfigFiles(): void {
254255
fs.writeFileSync(
255256
path.resolve(this.cwd, '.browserslistrc'),
256257
'> 0.25%, not dead'
257258
);
259+
fs.writeFileSync(
260+
path.resolve(this.cwd, 'postcss.config.js'),
261+
`/* eslint-disable global-require, import/no-extraneous-dependencies */
262+
module.exports = {
263+
// You can add more plugins and other postcss config
264+
// For more info see
265+
// <https://github.com/postcss/postcss-loader#configuration>
266+
// There is no need to use cssnano, webpack takes care of it!
267+
plugins: [require('autoprefixer')],
268+
};
269+
`
270+
);
258271
}
259272

260273
/**

0 commit comments

Comments
 (0)