Giter Club home page Giter Club logo

Comments (2)

adamwathan avatar adamwathan commented on June 5, 2024

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.

bradlc avatar bradlc commented on June 5, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.