Skip to content

Commit

Permalink
3.0.0 (#52)
Browse files Browse the repository at this point in the history
* prepare for tailwind CSS v3

* 3.0.0-beta.0

* 3.0.0
  • Loading branch information
forsartis committed Feb 27, 2022
1 parent 3fc77d3 commit a4c338e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 27 deletions.
18 changes: 0 additions & 18 deletions README.md
Expand Up @@ -27,23 +27,5 @@ module.exports = {
},
};
```
### Custom Tailwind config file name
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.
```javascript
// postcss.config.js
module.exports = {
plugins: {
tailwindcss: 'custom-name.js',
//...
},
};
```
### Configure PurgeCSS
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.
```javascript
purge: ['./public/**/*.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
```
Check [https://tailwindcss.com/docs/optimizing-for-production](https://tailwindcss.com/docs/optimizing-for-production) for more info.

## License
[MIT](https://github.com/forsartis/vue-cli-plugin-tailwind/blob/master/LICENSE)
15 changes: 7 additions & 8 deletions generator/index.js
Expand Up @@ -43,14 +43,14 @@ function generateConfig(api, option) {
});
}

function injectPurgeConfig(api) {
function injectContentConfig(api) {
const configPath = api.resolve(filenameTailwind);
const tailwindConfig = fs.readFileSync(configPath, 'utf-8');
fs.writeFileSync(
configPath,
tailwindConfig.replace(
'purge: []',
"purge: ['./public/**/*.html', './src/**/*.{vue,js,ts,jsx,tsx}']",
'content: []',
"content: ['./public/**/*.html', './src/**/*.{vue,js,ts,jsx,tsx}']",
),
);
}
Expand All @@ -59,10 +59,9 @@ module.exports = (api, options) => {
const postcss = readPostcssConfig(api);
const configs = {
dependencies: {
'@tailwindcss/postcss7-compat': '^2.2.17',
autoprefixer: '^9',
postcss: '^7',
tailwindcss: 'npm:@tailwindcss/postcss7-compat@^2.2.17',
autoprefixer: '^10',
postcss: '^8',
tailwindcss: '^3',
},
postcss: {
plugins: {
Expand Down Expand Up @@ -92,7 +91,7 @@ module.exports = (api, options) => {
if (options.initConfig && options.replaceConfig !== false) {
api.onCreateComplete(() => {
generateConfig(api, options.initConfig);
injectPurgeConfig(api);
injectContentConfig(api);
});
}
};
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "vue-cli-plugin-tailwind",
"version": "2.2.18",
"version": "3.0.0",
"description": "vue-cli plugin for Tailwind CSS",
"author": "Jens Eggerstedt <j.eggerstedt@kaibatech.de>",
"license": "MIT",
Expand Down

0 comments on commit a4c338e

Please sign in to comment.