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

Add the ability to see and copy JSON snippet #43

Closed
simensen opened this issue Aug 16, 2022 · 3 comments
Closed

Add the ability to see and copy JSON snippet #43

simensen opened this issue Aug 16, 2022 · 3 comments

Comments

@simensen
Copy link
Contributor

I'd be interested in having the ability to see and copy the color information as a JSON-compatible snippet in addition to the existing JavaScript snippet.

My use case is for tooling around colors that involve reading and consuming something like colors.json in some parts of the application but could also be used to inject as parsed JSON into tailwind.config.js.

Right now I'm doing this in my tailwind.config.js:

const colors = require('../branding/colors.js')

const fs = require('fs');

fs.writeFileSync('../branding/colors.json', JSON.stringify(colors));

module.exports = {
  theme: {
    extend: {
      colors,
    },
  },
}

Which is fine, but it would be nicer if I could maintain colors.json instead of colors.js and not have an extra build step required to get colors.json to exist.

const colors = require('../branding/colors.json')

module.exports = {
  theme: {
    extend: {
      colors,
    },
  },
}

Is this something you'd consider adding or supporting if I sent a PR?

@leoquack
Copy link
Owner

I would argue that converting JS to valid JSON is kinda trivial :D But it could definitely be included. Maybe in a dropdown option under the copy button, just like "save as new" is currently for shades? If you have something better in mind, let me know

image

@simensen
Copy link
Contributor Author

I think I'll leave this one for now. :) I don't have enough time to figure out how to do this and I already have a workaround. Thanks for merging #44. That is the main thing that will make my life easier. :)

@leoquack
Copy link
Owner

Sure thing! Thanks for the contribution :)

@leoquack leoquack closed this as not planned Won't fix, can't repro, duplicate, stale Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants