-
Notifications
You must be signed in to change notification settings - Fork 174
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
Package the tailwindcss
binary executable
#96
Package the tailwindcss
binary executable
#96
Conversation
There's also some risk that a download will be incomplete or the file will get corrupted on disk, and then that bad file will be packaged and shipped. We should probably be validating checksums, but a human would have to be involved today because checksums aren't provided with https://github.com/tailwindlabs/tailwindcss/releases releases. |
c5050d7
to
dff2539
Compare
Pushed a fix for darwin. |
dff2539
to
488de21
Compare
488de21
to
04f41ce
Compare
Modified the name of the binary executable to be simply "tailwindcss". |
This is very exciting. @flavorjones Does this PR mean that this gem now supports |
I've played with this a little bit, and it works fine. It is beautiful. We have the full TW power without the node ❤️ I've few remarks:
module.exports = {
content: [
'./app/helpers/**/*.rb',
'./app/javascript/**/*.js',
'./app/views/**/*.erb',
...
],
theme: {
extend: {...},
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/aspect-ratio'),
require('@tailwindcss/typography'),
],
}
@tailwind base;
@tailwind components;
@tailwind utilities; I guess this also need to be generated thought the engine on the install script.
Shim approach
In what ways it is more challenging, then having separate gems per platform? |
@muriloime Yes. Including all the Tailwind custom functions and directives, such as |
@dixpac Thanks for the comments! I actually know very little about tailwind so if you or @dhh have concrete ideas on how to finish the integration work please feel free to push more commits onto the branch.
By this comment I was referring to an antipattern that arose among chromedriver-helper users, wherein the version of chromedriver wasn't locked. The gem grabbed whatever was current when you ran it. This led to differences in behavior between static development machines (using cached older version) and CI containers (which downloaded the latest version), for example; or between different development machines. This particular flavor of problem was challenging to diagnose because the fetch was done lazily and the underlying binary's version wasn't obvious. |
Working on the direct integration now! Should have something ready for us to play with very soon. |
@flavorjones interesting thing I've just noticed (while trying to convert one real-world open source rails project using tw with node). The projects
I use Mac M1, so I've installed the gem run the installer everything looked fine. But running This may be just bad luck for me on this project, but it may be something that could possibly happen to others also. |
@dixpac ack. I'll try to take a look today. |
…n't correct (#102) * prefactor: expose constants related to upstream tailwindcss The following constants have been moved from rakelib/package.rake into lib/tailwindcss/upstream.rb to be accessible from within the installed gem: - TAILWINDCSS_VERSION → Tailwindcss::Upstream::VERSION - TAILWINDCSS_NATIVE_PLATFORMS -> Tailwindcss::Upstream::NATIVE_PLATFORMS * fix: provide more helpful error messages See #101 and comments in #96 for examples of what's confusing users.
See #102 for a potential fix |
@flavorjones it works 👏 |
This is an exploration of how we could package and redistribute the binaries from https://github.com/tailwindlabs/tailwindcss/releases with this gem.
Approach
The general approach followed here is to create a new gem file for each of the native binary platforms supported upstream:
in addition to the vanilla ruby gem which is unchanged by this PR. In each of those "native" gems, there will be two additional files:
exe/<platform>/tailwindcss
, the binary executable downloaded from tailwindlabs/tailwindcss (note the rename from upstream release)exe/tailwindcss
, a generic ruby script to find and run the binaryNote that the
exe/tailwindcss
script is required because rubygems requires that executables declared in a gemspec must be Ruby scripts (and we must declare an executable in order to hook into the user's shell$PATH
).Also note that the final gem sizes are much larger because of the size of the tailwind executable:
Tests
I've added a github actions pipeline to verify the executables work as desired on Linux, MacOS, and Windows.
Some questions to consider
What is the desired user experience for people not on one of the platforms published by tailwindcss?
tailwindcss
executable will simply not be present, which may be confusing.tailwindcss
script to notify the user may shadow the real executable when the user installs it, which may be even more confusing.What license or copyright declarations should be made in this project regarding redistributing
tailwindcss
?LICENSE-DEPENDENCIES
which lists the libraries being redistributed.What should the process be to update to a newer version of the binaries?
rakelib/package.rake
there's a constant that can be manually updated, is that fine?The binary isn't going to be available to anyone who's bundling using a git URL.
exe/tailwindcss
script download the binary if it's not availableAlternative approaches you might consider instead