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

Added tailwind #172

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ yarn-debug.log*
!/storage/.keep

/config/master.key

/app/assets/builds/*
!/app/assets/builds/.keep
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,5 @@ group :test do
gem "selenium-webdriver"
gem "webdrivers"
end

gem "tailwindcss-rails", "~> 2.0"
9 changes: 8 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ GEM
stimulus-rails (1.1.0)
railties (>= 6.0.0)
strscan (3.0.4)
tailwindcss-rails (2.0.14-aarch64-linux)
railties (>= 6.0.0)
tailwindcss-rails (2.0.14-arm64-darwin)
railties (>= 6.0.0)
tailwindcss-rails (2.0.14-x86_64-linux)
railties (>= 6.0.0)
thor (1.2.1)
timeout (0.3.0)
turbo-rails (1.3.1)
Expand Down Expand Up @@ -302,6 +308,7 @@ DEPENDENCIES
selenium-webdriver
sprockets-rails
stimulus-rails
tailwindcss-rails (~> 2.0)
turbo-rails
tzinfo-data
web-console
Expand All @@ -311,4 +318,4 @@ RUBY VERSION
ruby 3.1.2p20

BUNDLED WITH
2.3.12
2.3.22
Empty file added app/assets/builds/.keep
Empty file.
1 change: 1 addition & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
//= link_directory ../stylesheets .css
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
//= link_tree ../builds
13 changes: 13 additions & 0 deletions app/assets/stylesheets/application.tailwind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

/*
@layer components {
.btn-primary {
@apply py-2 px-4 bg-blue-200;
}
}
*/
5 changes: 4 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>

<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
</head>

<body>
<%= yield %>
<main class="container mx-auto mt-28 px-5">
<%= yield %>
</main>
</body>
</html>
22 changes: 22 additions & 0 deletions config/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const defaultTheme = require('tailwindcss/defaultTheme')

module.exports = {
content: [
'./public/*.html',
'./app/helpers/**/*.rb',
'./app/javascript/**/*.js',
'./app/views/**/*.{erb,haml,html,slim}'
],
theme: {
extend: {
fontFamily: {
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
},
},
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/aspect-ratio'),
require('@tailwindcss/typography'),
]
}
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ services:
depends_on:
- db
- redis
tailwind:
build: .
command: bash -c "bin/rails tailwindcss:watch"
volumes:
- .:/usr/src/app
- bundle:/usr/local/bundle
db:
image: postgres:15
ports:
Expand Down