Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.0 #52

Merged
merged 3 commits into from
Feb 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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