ã¯ããã«
Railsãã¥ã¼ããªã¢ã«ã®5ç« ãé²ãã¦ããä¸ã§ã
Railsã«è§¦ãã¦ããªãã¨ã¢ã»ãããã¤ãã©ã¤ã³ãããã®ãã¨å¿ãã¦ãã¾ããããªã®ã§ã
åå¿é²ã¨ãã¦æ¦è¦ãããã°ã«è¨è¿°ãã¾ãã
åå¿é²
ã¢ã»ãããã£ã¬ã¯ããª
éçãã¡ã¤ã«ãç®çå¥ã«åé¡ãããã£ã¬ã¯ããªã
以ä¸ããã©ã«ã3ã¤ã
app/assets
ï¼ã¢ããªã±ã¼ã·ã§ã³ç¨lib/assets
ï¼ã©ã¤ãã©ãªç¨vendor/assets
ï¼ãµã¼ããã¼ãã£ç¨
主ã«ç»åãJavaScriptãCSSã®ãµããã£ã¬ã¯ããªãç¨æããã¦ããã
ãããã§ã¹ããã¡ã¤ã«
ã¢ã»ããï¼â»ï¼ãã¡ã¤ã«ã1ã¤ã®ãã¡ã¤ã«ã«ã¾ã¨ããæç¤ºãè¨è¿°ããã
å®éã«å¦çã宿½ããã®ã¯ããSprocketsãã¨å¼ã°ããgemã
â»ãJavaScriptãCSSã®ã¿
rails new ã
ããéã«ä½æãããã
ã/app/assets/stylesheets/application.css
ã該å½ããã
/* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's * vendor/assets/stylesheets directory can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS * files in this directory. Styles in this file should be added after the last require_* statement. * It is generally better to create a new file per style scope. * *= require_tree . *= require_self */
ä¸è¨ã®ãã¡ã以ä¸ã®è¨è¿°ãè¨è¿°å 容ã«ç¸å½ããã
*= require_tree .
*= require_self
ããªããã»ããµã¨ã³ã¸ã³
ãããã§ã¹ããã¡ã¤ã«ãèªã¿åã£ã¦ã
ã¢ã»ãããã¡ã¤ã«ããã£ã¤ãã¦ããããã¤ã»ã»ã»
ã£ã¦è§£éã§ãã£ã¦ããããªã»ã»ã»ï¼
ãããï¼ãã£ããã¨ããè§£éï¼
ãã...ã¨ããããç¹å¾´ã¾ã¨ãããã©ã
ç°¡åãªä¸è¨äºè¨ãããã«å縮ãã¦è
¹è½ã¡ããã¦ããããã
ãªãã§ãã¨ãããã以ä¸ã§è¦ãã¦ãããã¨ã¨ãã¾ãã
- ã¢ã»ãããã¤ãã©ã¤ã³ã¯ãããã¤ï¼ã¦ãå®è¡æï¼ã«JS,CSSãæé©åãã¦ããããã¤
- åæã«ãã³ãã«ï¼æå°åã£ã¦è¨ãã°ããããªï¼ããã¦ããããã¤
詳ãããã¨ã¯ä»¥ä¸èªãã æ¹ãRailsãã¥ã¼ããªã¢ã«ããè
¹è½ã¡ãã¾ããã
ï¼ãããããæã¤ãããã¦ããã ãã¾ãããï¼
ãããããããæè¿ã¯ããã®Webpack
ã¨ãã«ç½®ãæãããã¦ããã®ããªã»ã»ã»ï¼
ãã®ãããã¯ã¾ã ã¾ã 調ã¹ãªãã¨ããããªã»ã»ã»
以ä¸ã§ãã