Skip to content

sassから画像を使えるようにし、メインビジュアルの画像を更新した#8939

Merged
machida merged 1 commit intomainfrom
new-people
Jul 17, 2025
Merged

sassから画像を使えるようにし、メインビジュアルの画像を更新した#8939
machida merged 1 commit intomainfrom
new-people

Conversation

@machida
Copy link
Copy Markdown
Member

@machida machida commented Jul 16, 2025

Summary by CodeRabbit

  • 新機能

    • Sassファイル内で image-url() ヘルパーを使用して画像パスを簡単に指定できるようになりました。
  • スタイル

    • .lp-top-cover の背景画像指定方法を改善し、画像サイズを一部調整しました。
    • 不要なセレクタや空白行を削除して、スタイルシートを整理しました。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 16, 2025

Walkthrough

この変更は、WebpackのSassローダー設定にカスタム関数image-urlを追加し、Sassファイル内でRails風のアセットパス指定を可能にしました。加えて、JavaScriptで画像アセットのインポート、Sassスタイルの背景画像指定の修正、不要なセレクタや空行の削除が行われています。

Changes

ファイル/パス 変更概要
app/javascript/packs/lp.js 画像ファイルpeople.pngをインポートする記述を追加
app/javascript/stylesheets/application/blocks/micro-report/_micro-report.sass 末尾の空行と未完成のセレクタ.micro-report-editor__formを削除
app/javascript/stylesheets/lp/blocks/lp/_lp-top-cover.sass background-imageimage-url関数に変更、SVG背景や&::before疑似要素を削除、lgブレークポイントの背景サイズを縮小
config/webpack/environment.js sass-loaderにカスタムSass関数image-url($path)を追加し、Webpackでのアセット解決をサポート

Sequence Diagram(s)

sequenceDiagram
    participant SassFile
    participant Webpack
    participant sass-loader
    participant AssetResolver

    SassFile->>sass-loader: image-url('background/people.png') を呼び出し
    sass-loader->>Webpack: カスタム関数で~から始まるパスに変換
    Webpack->>AssetResolver: 画像アセットを解決
    AssetResolver-->>Webpack: 解決した画像URLを返す
    Webpack-->>SassFile: CSSのurl()として出力
Loading

Poem

画像の道を案内する、
Sassの森に新しい風。
image-urlで楽々呼び出し、
余計な空行もさようなら。
うさぎは跳ねて、ビルドも軽やか、
アセットの旅はこれからも!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@machida machida changed the title scssから画像を使えるようにし、メインビジュアルの画像を更新した sassから画像を使えるようにし、メインビジュアルの画像を更新した Jul 16, 2025
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
config/webpack/environment.js (1)

10-23: sass-loaderのカスタム関数実装が適切です。

image-url関数の実装は正しく動作しますが、エラーハンドリングを追加することを推奨します。

以下のようにエラーハンドリングを追加できます:

 'image-url($path)': function(path) {
   const sass = require('sass')
-  const pathValue = path.getValue().replace(/['"]/g, '')
-  return new sass.types.String(`url("~${pathValue}")`)
+  try {
+    const pathValue = path.getValue().replace(/['"]/g, '')
+    if (!pathValue) {
+      throw new Error('Image path cannot be empty')
+    }
+    return new sass.types.String(`url("~${pathValue}")`)
+  } catch (error) {
+    console.error('Error in image-url function:', error)
+    return sass.types.Null.NULL
+  }
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5221213 and d7d5fdc.

⛔ Files ignored due to path filters (5)
  • app/assets/images/background/background.svg is excluded by !**/*.svg
  • app/assets/images/background/completion_background.svg is excluded by !**/*.svg
  • app/assets/images/background/error-background-main-color.svg is excluded by !**/*.svg
  • app/assets/images/background/people.png is excluded by !**/*.png
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • app/javascript/packs/lp.js (1 hunks)
  • app/javascript/stylesheets/application/blocks/micro-report/_micro-report.sass (0 hunks)
  • app/javascript/stylesheets/lp/blocks/lp/_lp-top-cover.sass (1 hunks)
  • config/webpack/environment.js (1 hunks)
💤 Files with no reviewable changes (1)
  • app/javascript/stylesheets/application/blocks/micro-report/_micro-report.sass
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js

Instructions used from:

Sources:
⚙️ CodeRabbit Configuration File

🧠 Learnings (1)
📓 Common learnings
Learnt from: tyrrell-IH
PR: fjordllc/bootcamp#8807
File: app/views/welcome/job_support.html.slim:391-392
Timestamp: 2025-06-21T22:30:20.116Z
Learning: このプロジェクトにはRailsの組み込みmarkdownヘルパが利用できないため、markdownのHTML変換には自前でヘルパを実装する必要がある。
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (3)
app/javascript/packs/lp.js (1)

11-13: 画像のインポートが適切に実装されています。

webpackによる画像のコピーを確実にするためのインポートが正しく追加されています。コメントも分かりやすく説明されています。

app/javascript/stylesheets/lp/blocks/lp/_lp-top-cover.sass (2)

2-2: image-url関数の使用が適切です。

新しく実装されたimage-url関数を正しく使用しており、webpackによる画像パスの解決が適切に行われます。


8-8: 背景画像サイズの調整が適切です。

背景画像サイズを36remから32remに変更することで、視覚的なバランスが改善されます。

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 this pull request may close these issues.

1 participant