-
Notifications
You must be signed in to change notification settings - Fork 62
Make generators compatible with importmaps #200
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,14 @@ def add_tailwind_css | |
|
|
||
| def add_tailwind_config | ||
| say "Adding RubyUI config to tailwind config" | ||
| template "tailwind.config.js.erb", Rails.root.join("tailwind.config.js") | ||
|
|
||
| if File.exist?(Rails.root.join("tailwind.config.js")) # tailwindcss js package | ||
| template "tailwind.config.js.js-package.erb", Rails.root.join("tailwind.config.js") | ||
| elsif File.exist?(Rails.root.join("config/tailwind.config.js")) # tailwindcss-rails gem | ||
| template "tailwind.config.js.tailwindcss-rails.erb", Rails.root.join("config/tailwind.config.js") | ||
| else | ||
|
Comment on lines
+60
to
+64
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rails apps using importmaps use tailwindcss-rails gem, the config file is located on |
||
| say "Cannot find tailwind.config.js. You will need to install tailwind config manually", :red | ||
| end | ||
| end | ||
|
|
||
| def add_ruby_ui_base | ||
|
|
||
File renamed without changes.
81 changes: 81 additions & 0 deletions
81
lib/generators/ruby_ui/install/templates/tailwind.config.js.tailwindcss-rails.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| const defaultTheme = require('tailwindcss/defaultTheme') | ||
|
|
||
| module.exports = { | ||
| content: [ | ||
| './app/views/**/*.rb', // Phlex views | ||
| './app/components/**/*.rb', // Phlex components | ||
| './public/*.html', | ||
| './app/helpers/**/*.rb', | ||
| './app/javascript/**/*.js', | ||
| './app/views/**/*.{erb,haml,html,slim}' | ||
| ], | ||
| darkMode: ["class"], | ||
| theme: { | ||
| container: { | ||
| center: true, | ||
| padding: "2rem", | ||
| screens: { | ||
| "2xl": "1400px", | ||
| }, | ||
| }, | ||
| extend: { | ||
| colors: { | ||
| border: "hsl(var(--border))", | ||
| input: "hsl(var(--input))", | ||
| ring: "hsl(var(--ring))", | ||
| background: "hsl(var(--background))", | ||
| foreground: "hsl(var(--foreground))", | ||
| primary: { | ||
| DEFAULT: "hsl(var(--primary))", | ||
| foreground: "hsl(var(--primary-foreground))", | ||
| }, | ||
| secondary: { | ||
| DEFAULT: "hsl(var(--secondary))", | ||
| foreground: "hsl(var(--secondary-foreground))", | ||
| }, | ||
| destructive: { | ||
| DEFAULT: "hsl(var(--destructive))", | ||
| foreground: "hsl(var(--destructive-foreground))", | ||
| }, | ||
| muted: { | ||
| DEFAULT: "hsl(var(--muted))", | ||
| foreground: "hsl(var(--muted-foreground))", | ||
| }, | ||
| accent: { | ||
| DEFAULT: "hsl(var(--accent))", | ||
| foreground: "hsl(var(--accent-foreground))", | ||
| }, | ||
| popover: { | ||
| DEFAULT: "hsl(var(--popover))", | ||
| foreground: "hsl(var(--popover-foreground))", | ||
| }, | ||
| card: { | ||
| DEFAULT: "hsl(var(--card))", | ||
| foreground: "hsl(var(--card-foreground))", | ||
| }, | ||
| /* ruby_ui especific */ | ||
| warning: { | ||
| DEFAULT: "hsl(var(--warning))", | ||
| foreground: "hsl(var(--warning-foreground))", | ||
| }, | ||
| success: { | ||
| DEFAULT: "hsl(var(--success))", | ||
| foreground: "hsl(var(--success-foreground))", | ||
| }, | ||
| }, | ||
| borderRadius: { | ||
| lg: `var(--radius)`, | ||
| md: `calc(var(--radius) - 2px)`, | ||
| sm: "calc(var(--radius) - 4px)", | ||
| }, | ||
| fontFamily: { | ||
| sans: ["var(--font-sans)", ...defaultTheme.fontFamily.sans], | ||
| }, | ||
| }, | ||
| }, | ||
| plugins: [ | ||
| require('@tailwindcss/forms'), | ||
| require('@tailwindcss/typography'), | ||
| require('@tailwindcss/container-queries'), | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two packages didn't play well with importmaps, so I'm pointing to remote cdn. My first take was to download the file and add to vendor/javascript folder and add
pin "motion"to config/importmap.rb, but I'm not sure if that was the best option, because it could go wrong if user tried to update/redownload the packages. If think it's safer to point to CDN and let the users download the file if they want.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephannv , this is fine. Tippy.js will be replaced by floating-ui, and motion is used on the Accordion, but I don't think we need any dependency there. In other words, it's fine, and we should remove both dependencies soon.