Skip to content

Commit 70b5e36

Browse files
committed
prepare for tailwind CSS v3
1 parent 3fc77d3 commit 70b5e36

File tree

2 files changed

+7
-26
lines changed

2 files changed

+7
-26
lines changed

README.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,5 @@ module.exports = {
2727
},
2828
};
2929
```
30-
### Custom Tailwind config file name
31-
If you use a name other than `tailwind.config.js` for the Tailwind config file, you will need to specify it in your PostCSS configuration.
32-
```javascript
33-
// postcss.config.js
34-
module.exports = {
35-
plugins: {
36-
tailwindcss: 'custom-name.js',
37-
//...
38-
},
39-
};
40-
```
41-
### Configure PurgeCSS
42-
By default PurgeCSS will look for css selectors in your `.html` files inside the `./public` directory and `.vue, .js, .ts, .jsx, .tsx` files inside the `./src` directory.
43-
```javascript
44-
purge: ['./public/**/*.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
45-
```
46-
Check [https://tailwindcss.com/docs/optimizing-for-production](https://tailwindcss.com/docs/optimizing-for-production) for more info.
47-
4830
## License
4931
[MIT](https://github.com/forsartis/vue-cli-plugin-tailwind/blob/master/LICENSE)

generator/index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ function generateConfig(api, option) {
4343
});
4444
}
4545

46-
function injectPurgeConfig(api) {
46+
function injectContentConfig(api) {
4747
const configPath = api.resolve(filenameTailwind);
4848
const tailwindConfig = fs.readFileSync(configPath, 'utf-8');
4949
fs.writeFileSync(
5050
configPath,
5151
tailwindConfig.replace(
52-
'purge: []',
53-
"purge: ['./public/**/*.html', './src/**/*.{vue,js,ts,jsx,tsx}']",
52+
'content: []',
53+
"content: ['./public/**/*.html', './src/**/*.{vue,js,ts,jsx,tsx}']",
5454
),
5555
);
5656
}
@@ -59,10 +59,9 @@ module.exports = (api, options) => {
5959
const postcss = readPostcssConfig(api);
6060
const configs = {
6161
dependencies: {
62-
'@tailwindcss/postcss7-compat': '^2.2.17',
63-
autoprefixer: '^9',
64-
postcss: '^7',
65-
tailwindcss: 'npm:@tailwindcss/postcss7-compat@^2.2.17',
62+
autoprefixer: '^10',
63+
postcss: '^8',
64+
tailwindcss: '^3',
6665
},
6766
postcss: {
6867
plugins: {
@@ -92,7 +91,7 @@ module.exports = (api, options) => {
9291
if (options.initConfig && options.replaceConfig !== false) {
9392
api.onCreateComplete(() => {
9493
generateConfig(api, options.initConfig);
95-
injectPurgeConfig(api);
94+
injectContentConfig(api);
9695
});
9796
}
9897
};

0 commit comments

Comments
 (0)