Skip to content

Commit b4b7cd8

Browse files
committed
feat: cssbundling-railsを導入、foreman導入、bin/devで自動更新するように
1 parent de96c91 commit b4b7cd8

13 files changed

Lines changed: 556 additions & 46 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ gem "puma", ">= 6.0"#~> 6.0 は、Puma 6.0 以上、かつ 7.0 未満の最新
1414
#gem 'webpacker', '~> 5.0'
1515
gem "propshaft"
1616
gem 'jsbundling-rails'
17+
gem 'cssbundling-rails'
1718

1819
gem 'turbolinks', '~> 5'
1920
gem 'jbuilder', '~> 2.7'

Gemfile.lock

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ GEM
102102
concurrent-ruby (1.3.5)
103103
connection_pool (2.4.1)
104104
crass (1.0.6)
105+
cssbundling-rails (1.4.3)
106+
railties (>= 6.0.0)
105107
date (3.4.1)
106108
diff-lcs (1.6.2)
107109
dockerfile-rails (1.7.9)
@@ -263,7 +265,7 @@ GEM
263265
sentry-ruby (5.23.0)
264266
bigdecimal
265267
concurrent-ruby (~> 1.0, >= 1.0.2)
266-
set (1.0.4)
268+
set (1.1.2)
267269
sidekiq (7.3.6)
268270
connection_pool (>= 2.3.0)
269271
logger
@@ -314,6 +316,7 @@ DEPENDENCIES
314316
bunny
315317
byebug
316318
capybara (>= 3.26)
319+
cssbundling-rails
317320
dockerfile-rails (>= 1.7)
318321
jbuilder (~> 2.7)
319322
jsbundling-rails
@@ -340,4 +343,4 @@ RUBY VERSION
340343
ruby 3.3.6p108
341344

342345
BUNDLED WITH
343-
2.2.16
346+
2.7.1

Procfile.dev

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
web: bin/rails server
2-
js: bin/rails javascript:build --watch
2+
js: yarn build:js:watch
3+
css: yarn build:css:watch # TailwindCSS などを使う場合css: yarn build:css --watch

app/assets/stylesheets/application.css

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@import "tailwindcss";
2+
3+
* {
4+
box-sizing: border-box;
5+
font-size: inherit;
6+
/* フォントレンダリングを統一・Braveのレイアウト崩れ防止 */
7+
-webkit-font-smoothing: antialiased;
8+
-moz-osx-font-smoothing: grayscale;
9+
text-rendering: optimizeLegibility;
10+
font-variant-ligatures: none;
11+
}
12+
body, html {
13+
margin: 0;
14+
padding: 0;
15+
height: 100vh;
16+
font-size: 16px; /* 基準サイズを明確に指定 */
17+
font-family: sans-serif;
18+
display: flex;
19+
flex-direction: column;
20+
overscroll-behavior: none;
21+
}

app/javascript/application.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import React from 'react'
1010
import ReactDOM from 'react-dom/client'
1111
//import Shogi from '../components/shogi/index'
1212
import Shogi from './components/shogi/index.js';
13+
import Matching from './matching.js';
1314
//import Header from '../components/Header';
1415
import Header from './components/Header.jsx';
1516

app/javascript/matching.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ class Matching extends React.Component {
884884

885885
<div className={`h-[calc(100%-30px)] flex items-center justify-center from-indigo-500 to-purple-600 p-4 bg-no-repeat bg-cover bg-center bg-[url('${gamebackPath}')]`}>
886886
<div className="bg-[#696969] p-8 rounded-lg shadow-xl w-full max-w-md text-center">
887-
<h1 className="text-3xl font-extrabold text-white mb-6">{t('matching.title')}</h1>
887+
<h1 className="text-3xl font-extrabold text-white mb-6">aああ{t('matching.title')}</h1>
888888
<div className="mb-6">
889889
<label className="mr-4 text-white">
890890
<input
@@ -1462,6 +1462,8 @@ document.addEventListener('turbo:load', () => {
14621462
});
14631463

14641464

1465+
export default Matching;
1466+
14651467
//export default withTranslation()(Matching);
14661468

14671469
/*// withTranslation で t を注入

app/views/matching/game_lobby_matching_board.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<%#= react_component("matching", { }) %>
99

1010
<meta id="matching-data" data-session-id="<%= session.id.to_s %>" data-matching-queue="<%= @matching_queue_data %>">
11-
<%= react_component("Header", { logoPath: asset_path("Logo.png") }) %>
11+
<%#= react_component("Header", { logoPath: asset_path("Logo.png") }) %>
1212
<%= stylesheet_link_tag 'game_lobby_matching_board', media: 'all' %>
1313

1414

bin/dev

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1-
#!/usr/bin/env ruby
2-
exec "./bin/rails", "server", *ARGV
1+
#!/usr/bin/env sh
2+
3+
if gem list --no-installed --exact --silent foreman; then
4+
echo "Installing foreman..."
5+
gem install foreman
6+
fi
7+
8+
# Default to port 3000 if not specified
9+
export PORT="${PORT:-3000}"
10+
11+
exec foreman start -f Procfile.dev --env /dev/null "$@"

config/environments/development.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44
# アセットの動的コンパイルを有効化
55
config.assets.compile = true
66
config.assets.debug = true
7+
#config.assets.compile = false # jsbundling-rails使用時はfalse
8+
#config.assets.debug = false # jsbundling-rails使用時はfalse
9+
710
config.assets.digest = false
11+
#config.assets.digest = true
812

913
# Settings specified here will take precedence over those in config/application.rb.
1014

11-
# Make code changes take effect immediately without server restart.
12-
config.enable_reloading = true
15+
# コード変更を即時反映
16+
config.cache_classes = false
17+
config.enable_reloading = true # サーバーの再起動なしで、コードの変更を即時に反映させる。
1318

1419
# Do not eager load code on boot.
1520
config.eager_load = false

0 commit comments

Comments
 (0)