Comments (2)
Hey! Prettier already supports using a different config in each directory I think doesn't it? Does it work if you just add a pretter.config.js
file to each subdirectory that needs to specify the Tailwind config?
from prettier-plugin-tailwindcss.
Hey @gekkedev. It is not possible for plugins to provide Prettier configuration options that accept array or object values, so I'm not sure how we would provide something like this. Also, as Adam said, you can already achieve this using multiple Prettier config files, for example:
my-app/
├─ project-1/
│ ├─ prettier.config.js
│ ├─ tailwind.config.js
├─ project-2/
│ ├─ prettier.config.js
├─ project-3/
│ ├─ tailwind.config.js
// project-1/prettier.config.js
module.exports = {
tailwindConfig: './tailwind.config.js',
}
// project-2/prettier.config.js
module.exports = {
tailwindConfig: '../project-3/tailwind.config.js',
}
If you want to share common options you could create a config in the root that you import into each project's config:
// prettier.config.js
module.exports = {
singleQuote: true,
}
// project-1/prettier.config.js
module.exports = {
...require('../prettier.config.js'),
tailwindConfig: './tailwind.config.js',
}
// project-2/prettier.config.js
module.exports = {
...require('../prettier.config.js'),
tailwindConfig: '../project-3/tailwind.config.js',
}
Also, with this kind of setup you don't need to run Prettier separately in each directory. Prettier will automatically use the correct config for each file based on its path. For example project-1/example.html
will use project-1/prettier.config.js
and project-2/example.html
will use project-2/prettier.config.js
I hope that helps!
from prettier-plugin-tailwindcss.
Related Issues (20)
- tailwindFunction not working HOT 1
- VS Code format on save fights with prettier format (while linting) HOT 9
- Problem with eslint and prettier-plugin-tailwindcss [Prettier Plugin] HOT 7
- Inconsistent sorting between formatting all files and a single file HOT 2
- Bad sorting for 'dark:' pseudoselector HOT 2
- Styling an existing component doesn't seem to work in twin.macro/react-twc HOT 1
- `3xl:` ends up in front of `xl` and `2xl` HOT 2
- Breaks with import assertions (`assert { type: 'json' }`) HOT 4
- [v4] Order discrepancy between prettier-plugin-tailwindcss and intellisense HOT 1
- Please add support for `zackad/prettier-plugin-twig-melody` HOT 9
- If `node_modules` folder does not contain prettier-plugin-astro, it does not work HOT 1
- Modifier order does not change HOT 2
- Doesn't work with Shopify Liquid extension HOT 2
- reordering doesn't respect backets when there is a space HOT 2
- Sorting of extended values does not work properly HOT 6
- [Prettier Plugin] v4 Different `prettier/prettier` eslint rule sorting behavior and results on Windows and Linux emitting warnings on the other OS HOT 3
- Plugin integration with the third-party imports plugin is not working HOT 3
- Support placeholder (generic class attribute) for tailwindAttributes
- The plugin does not work for classes declared in <script setup> as variables. HOT 1
- Inconsistent sorting of classes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-plugin-tailwindcss.