sharoa
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 【第8週】パRails輪読会🚂 \(2023\-10\-10\~ 2023\-10\-13\) ###### tags: `パRails🚂` - [開催概要](https://hackmd.io/4A_8ahJtQNi5hz713N5Y7w?view) - [パRails輪読会 ノートまとめ](https://hackmd.io/jsgA8Pf_RVioOgSL_VOR4g) - サンプルコード・正誤表:[サポートページ:パーフェクトRuby on Rails【増補改訂版】:|技術評論社](https://gihyo.jp/book/2020/978-4-297-11462-6/support) - **サンプルコードをダウンロードしただけでは、すぐに`rails s`できない可能性が高い**です。 以下のページに環境構築の手順をまとめたので、ドライバーをやってくださるという方は、こちらに沿って環境構築をお願いします🙏 ⏩ [環境構築の手順 2022年版](https://hackmd.io/y7qb2BRMT2Wd4tAtKYObcQ) ⏩ [環境構築の手順 2023年版](https://hackmd.io/3_lnn8_QRD6wEjwFbWcBzQ) 💁‍♀️ [更新の手順 2章編](https://hackmd.io/pZAmF2EjSmyQ38lUtJ_CqA) ## 目次 [TOC] ------ ## 2023\-10\-10(火) ### ファシリ ### ドライバー ### 読んだところ 4-1-3 「Webpackerの設定ファイル」から 4-1-4(183p)の終わりまで。 PR: ### 次回 4-1-5 「ライブラリの統合」から。🚂 ### 学んだこと・感想 - @sharoa - Webpackerは初期設定から何も変更しなくともある程度うまく動作するように設定されているらしい。(優秀) - webpackを単体で利用するときはwebpack.config.jsという設定ファイルを利用するが、Webpacker環境ではそれを直接扱わず、config/webpacker.ymlで、defaultというキーで共通の設定をおこない、環境ごとに共通設定を利用・上書きするような形式で出力先などを定義する。 - staging環境を追加したい場合は、stagingをトップレベルのキーとして追加する。 - 他にもいろいろとあったのですが、ちょっと難しすぎて、、、また読み直す!!本当に。とはおもったけど、このwebpackerってもう使われないんだっけな。。。? - @moegi29 - webpacker.ymlに`*default'というキーを書くことで環境ごとに共通設定を利用できる。 - staging環境は本番環境と同じ状態でシステムの動作や不具合のチェックをする環境のこと。 - 同じディレクトリ内にcssとjsがある場合、js内にrequire("stylesheets/application")と書くことでCSSが使える。webpackerでも管理できる。 - @sadanora - webpack単体で扱う場合は`webpack.config.js`に設定を書くが、Webpacker環境では`config/webpacker.yml`で環境ごとの設定を書くことができる - `webpack.config.js`を直接編集することはない - ビルド対象が多い場合は`webpack-dev-server`を使うと便利 - 監視対象のファイルの変更を検知して自動でビルドしてくれる - 急にJSの話が増えて?難しい - babelとかモジュールのrequireとかでてきたけど、特に説明がないので前提知識として知っていないと理解が難しいと思う - motohiro-mm - webpackerの設定ファイルは`config/webpacker.yml`と`config/webpack/*.js` - webpack環境で書いたJSは編集ごとにビルドが必要 - 手動ビルド:`bin/webpack` - サーバーを利用:`bin/webpack-dev-server` - ビルド対象が多くページの表示に時間がかかる場合 - そもそもJSもあまりよく分かっていないので、ふわふわした認識になっていますが、なんとかついていきたいです - @hiromisugie - 引き続きWebpacker。難しい、、、 - ymlの書き方。`<<: *default`は、defaultの設定をそのまま持ってくる、という感じ。 - CSSや画像を、SprocketsではなくWebpackerで管理することもできることを知った。どのような時にそれが有効なのかはわからなかったけど、なるほど〜と思った。 - マイグレーションファイルがちょっとおかしい場合の簡易的な対処を教えてもらい助かりました🙏(実際にDBに色々入ってる場合など、こんなサクッとやってはいけないシーンも多々あると思いますが) - `rails db:drop`して今のDBを一旦削除し、`rails db:create`で新規作成し、`rails db:migrate`で改めてマイグレートする ------ ## 2023\-10\-11(水) ### ファシリ @sharoa ### ドライバー @hiromisugie ### 読んだところ 4-1-5 「ライブラリの統合」から 4-2-1 189p 途中まで。 PR: https://github.com/motohiro-mm/Perfect_Ruby_on_Rails_Ch4/pull/5 ### 次回 4-2-1 189p 「stylesheetsディレクトリ内に~」から。🚂 ### 学んだこと・感想 - @sharoa - WebpackerはReactやVue.jsなどいくつかのライブラリをすぐに導入するためのコマンドを提供している。 - Reactを導入したい場合にはrails newでオプションでつけるのと、既存のRailsアプリケーションに導入できるのと2つある。 - `prepend`ってなに?って思いましたが、jsのコマンドだそうで、、jsの予習もしないと大変そう。 - Sprocketsは従来のRailsで利用されてきたフロントエンドで利用するパッケージングシステムのこと。このSprocketsを利用してCSSのソースコードのコンパイルや縮小、圧縮を行う。 - @moegi - reactオプションをつけることでrails newするときにreactをインストール、`webpacker:install:react`で既存のrailsアプリにreactを導入できる。実際に試してもらったことでreactが使えるようになったかがよくわかりました。 - SprocketsはSCSSをCSSへコンパイルする機能や1つのファイルへ統合する処理とかフロントエンド開発によく利用される機能を提供している - @sadanora - `$ webpacker:install`で色々なライブラリを追加することができる。 - ReactやVueなどもこのコマンドで導入できる - Webpackerの設定の拡張 - pluginsやloaderなどを追加して設定を拡張できる。 - 素のWebpackでは`webpack.config.js`を編集するが、Webpackerの場合`webpack.config.js`はないので、`webpacker:install`や`yarn install`などでライブラリのインストール後に `config/webpack/`配下に設定ファイルを置くなどして設定する。 - @hiromisugie - ここへきて`webpack`と`Webpacker`という表記の違いを認識したので調べた。と思いきや、この章冒頭のP172でちゃんと説明してあった…。調べたURLは一応貼っておきます - https://qiita.com/jesus_isao/items/1f519b2c6d53f336cadd#webpack%E3%81%A8webpacker%E3%81%AE%E9%96%A2%E4%BF%82 - ReactやVueを入れたりloader・pluginを入れる方法を読んだが、全然理解できていないので必要な際にここに戻ってきて復習できるようにしておきたい、と思った。 - Reactなどは、rails newするときにも入れられるし後から追加で入れられる、ということはわかった。 - とにかくJavaScriptについても知らねばならぬことを痛感しています。 ----- ## 2023\-10\-12(木) ### ファシリ @moegi ### ドライバー @motohiro-mm ### 読んだところ 4-2-1 189p 「stylesheetsディレクトリ内に~」から 192p 4-2-1の終わりまで。 PR:https://github.com/motohiro-mm/Perfect_Ruby_on_Rails_Ch4/pull/6 ### 次回 4-2-2 192p 「本番環境向けのビルド」から。🚂 ### 学んだこと・感想 - @sharoa - 例としてのっていたCSSファイルで、一見コメントアウトされたようなファイルに見えるけど、`*=`で始まる行はSprocketsが解釈するための特別なディレクティブ。 - ディレクティブってなんやねん、という感じでしたのでしらべてみた。 - https://www.javadrive.jp/servlet/jsp_directive/index1.html - 読んだところですぐ理解できるものでもなかったです。 - SCSSとCSSは基本的な構文に大きな違いがない。そのため、CSSにかなり近い記述方法をしているが、SCSSで記述しているため、タグの親子関係を入れ子として記述している。 - @sadanora - sprockets - scssなどのcss拡張言語をcssにコンパイルしたり、複数のcssファイルをひとつにまとめたりしてくれる。ビルドの設定などを気にしなくてもよしなにCSSへの変換をしてくれる。 - `app/assets/stylesheets/application.css`でrequireの順番を変えると、ファイルの読み込み順の制御ができる - @moegi - http://localhost:3000/assets/application.dubug-xxx.css などのURLで追加されているxxx部分はフィンガープリントという値。実際にブラウザから見れたことでどこの値のことなのかがわかった。 - Sprocketsを使うことでビルド用の特別な設定をせずSCSSの記述からCSSへ変換されて1つのファイルに結合できる。 - @motohiro-mm - 「.debug付きのファイルは各種ファイルを結合しつつSource Mapの情報を付与したファイルです」以降の説明が今だによくわかりません… - スタイルの追加方法とそれを開発者ツールで確認する方法が分かったので、それは良かったです! -----

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully