Skip to content

Expose helper for calling Tailwind CLI #142

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

Closed
willcosgrove opened this issue Feb 15, 2022 · 1 comment · Fixed by #197
Closed

Expose helper for calling Tailwind CLI #142

willcosgrove opened this issue Feb 15, 2022 · 1 comment · Fixed by #197

Comments

@willcosgrove
Copy link
Contributor

I've run into this need a couple of times now, and I thought that this gem might be the right home for a utility like this. Basically, I am needing a way to call the tailwindcss binary to have it generate styles for me on demand. This gem is already solving the problem of getting the binary in place on the system, but it doesn't expose any way to access it externally.

At the most basic, something like this would be really helpful:

module Tailwindcss
  TAILWIND_CLI_PATH = -File.expand_path("#{Pathname.new(__dir__)}/../exe/tailwindcss")

  def self.path
    TAILWIND_CLI_PATH
  end
end

It could also possibly expose an API for calling the binary, but there are many different ways to do that, and there may not be a reasonable one-size-fits-all approach, so it may be best to just leave it at the path.

module Tailwindcss
  TAILWIND_CLI_PATH = -File.expand_path("#{Pathname.new(__dir__)}/../exe/tailwindcss")

  def self.path
    TAILWIND_CLI_PATH
  end

  def self.call(*args)
    `#{path} #{args.join(' ')}`
  end
end

This could be accomplished in a different gem, but more than likely any user of that gem would also be using this gem, and it seems non-ideal to download the binary twice. Would the maintainers of this gem be open to exposing the path of the binary like this?

@flavorjones
Copy link
Member

Will be addressed by #197

@flavorjones flavorjones linked a pull request Sep 3, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants