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

Tailwind Debug Mode [in Phoenix? 🤞] #2

Open
2 tasks
nelsonic opened this issue Jun 14, 2022 · 3 comments
Open
2 tasks

Tailwind Debug Mode [in Phoenix? 🤞] #2

nelsonic opened this issue Jun 14, 2022 · 3 comments
Assignees
Labels
chore a tedious but necessary task often paying technical debt documentation Improvements or additions to documentation enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! priority-2 Second highest priority, should be worked on as soon as the Priority-1 issues are finished T1h Time Estimate 1 Hour

Comments

@nelsonic
Copy link
Member

nelsonic commented Jun 14, 2022

https://github.com/jeroengerits/tailwind-debug-mode

Need to investigate how to add this when using Tailwind with Phoenix given that we don't have a package.json ... how do we add these "plugins" to our build pipeline?

@SimonLab could you please:

  • take a look when you're reviewing this repo and
  • add a section at the bottom of the README.md on "Debugging".

Thanks! 🙏

@nelsonic nelsonic added the enhancement New feature or enhancement of existing functionality label Jun 14, 2022
@nelsonic nelsonic added priority-3 Third priority. Considered "Nice to Have". Not urgent. documentation Improvements or additions to documentation chore a tedious but necessary task often paying technical debt T1h Time Estimate 1 Hour labels Jun 22, 2022
@nelsonic nelsonic changed the title Debug Mode Tailwind Debug Mode [in Phoenix? 🤞] Jun 22, 2022
@nelsonic
Copy link
Member Author

Having this would be super useful while figuring out the layout in the MVP ... ⏳

@nelsonic nelsonic added priority-2 Second highest priority, should be worked on as soon as the Priority-1 issues are finished and removed priority-3 Third priority. Considered "Nice to Have". Not urgent. labels Jul 16, 2022
@nelsonic nelsonic added the help wanted If you can help make progress with this issue, please comment! label Oct 4, 2022
@nelsonic
Copy link
Member Author

@ndrean
Copy link

ndrean commented Sep 13, 2024

Just saw this. It is great!

I will use it this (lazy) way:

In "root.html.heex", you add the button,

<button
    id="tailwind-debug"
    style="
          padding: 0.3rem 1.2rem !important;
          font-weight: bold;
          border-radius: 1rem;
          background-color: #cceecc !important;
          color: black !important;
        "
    >
    TOGGLE DEBUG MODE
</button>

and add the JS listener in "/assets/app.js":

document.getElementById("tailwind-debug").addEventListener("click", () => {
  if (document.body.className.includes("debug")) {
    document.body.className = document.body.className.replace("debug", "");
  } else {
    document.body.className += " debug";
  }
});

copy/paste https://github.com/jeroengerits/tailwind-debug-mode/blob/main/src/index.js in the "/assets/js/debug.js" folder,

and modify the "tailwind.config.js" file:

import debug from "./js/debug";
  ^^
...
module.exports = {
  plugins: [
    require("@tailwindcss/forms"),
    debug,
   ^^
   ....
  ]
}

Screenshot 2024-09-13 at 12 28 44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore a tedious but necessary task often paying technical debt documentation Improvements or additions to documentation enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! priority-2 Second highest priority, should be worked on as soon as the Priority-1 issues are finished T1h Time Estimate 1 Hour
Projects
None yet
Development

No branches or pull requests

3 participants