{"id":7570,"date":"2019-11-27T23:00:24","date_gmt":"2019-11-27T14:00:24","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=7570"},"modified":"2023-05-27T22:59:00","modified_gmt":"2023-05-27T13:59:00","slug":"%e3%80%90ruby-on-rails%e3%80%91rails%e3%81%abbootstrap%e3%82%92%e5%b0%8e%e5%85%a5%e3%81%99%e3%82%8b%e3%80%82","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=7570","title":{"rendered":"\u3010Ruby on Rails\u3011Rails\u306bBootstrap\u3092\u5c0e\u5165\u3059\u308b\u3002"},"content":{"rendered":"<h2>Rails\u306bBootstrap\u3092\u5c0e\u5165\u3059\u308b\u624b\u9806<\/h2>\n<p>Gemfile\u306b\u4e0b\u8a18\u5185\u5bb9\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002\uff08mini_racer\u306fautoprefixer-rails\u3068\u3044\u3046Gem\u306e\u52d5\u4f5c\u306b\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\uff09<\/p>\n<pre class=\"lang:default decode:true \">gem 'bootstrap'\r\ngem 'mini_racer'\r\ngem 'jquery-rails' \u2605Rails5.1\u4ee5\u964d\u306e\u5834\u5408<\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">bundle<\/pre>\n<h2>BootStrap\u306eCSS\u30b3\u30fc\u30c9\u3092Rails\u306eCSS\u306b\u5c0e\u5165\u3059\u308b\u3002<\/h2>\n<h3>app\/assets\/stylesheets\/application.css\u3092\u524a\u9664\u3057\u300capplication.scss\u300d\u3092\u4f5c\u6210\u3059\u308b\u3002<\/h3>\n<p>\u300capp\/assets\/stylesheets\/application.css\u300d\u304cRails\u30a2\u30d7\u30ea\u5168\u4f53\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306eCSS\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u305f\u3060\u3001SCSS\u3068\u3044\u3046CSS\u958b\u767a\u306e\u52b9\u7387\u5316\u306e\u8a18\u6cd5\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u4e00\u65e6\u524a\u9664\u3092\u3057\u3066\u300capplication.scss\u300d\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u5143\u3005\u8a18\u8f09\u3055\u308c\u3066\u3044\u305f\u5185\u5bb9\uff08*= require_tree .\u7b49\uff09\u3092\u5168\u3066\u524a\u9664\u3057\u3066\u3001application.scss\u306b\u4e0b\u8a18\u306e\u8a18\u8ff0\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">@import \"bootstrap\";<\/pre>\n<p>\u3053\u308c\u3067\u4eca\u5f8cRails\u3067\u4f5c\u6210\u3059\u308bHTML\u306bBootStrap\u306eCSS\u304c\u5f53\u305f\u3063\u305f\u72b6\u614b\u3067\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h2>\u3069\u3053\u3067application.css\u306fRails\u306eHTML\u306b\u9069\u7528\u3055\u308c\u3066\u3044\u308b\u306e\u304b\uff1f<\/h2>\n<p>app\/views\/layouts\/application.html\u306b\u3066\u3067application.css\u306f\u9069\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u30ec\u30a4\u30a2\u30a6\u30c8\u30d5\u30a1\u30a4\u30eb\u3068\u3044\u3044\u3001\u30ec\u30a4\u30a2\u30a6\u30c8\u30d5\u30a1\u30a4\u30eb\u306f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306b\u5bfe\u5fdc\u3059\u308b\u540d\u524d\u306e\u3082\u306e\u304c\u63a1\u7528\u3055\u308c\u307e\u3059\u3002\u306a\u304a\u3001\u300capplication.html\u300d\u306fApplicationController\u306b\u5bfe\u5fdc\u3057\u3066\u304a\u308a\u3001\u4eca\u5f8c\u4f5c\u6210\u3059\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306f\u5168\u3066ApplicationController\u3092\u7d99\u627f\u3057\u3066\u4f5c\u6210\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u300capp\/assets\/stylesheets\/application.css\u300d\u306f<span style=\"color: #ff0000;\"><strong>\u81ea\u52d5\u7684\u306b\u5168\u3066\u306eRails\u306eHTML\u306b\u5bfe\u3059\u308b\u5171\u901aCSS\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u308b\u306e\u3067\u3059\u3002<\/strong><\/span><\/p>\n<h2>JS\u306e\u5c0e\u5165<\/h2>\n<p>\u4e0b\u8a18\u306ebootstrap-rubygem\u306e\u30da\u30fc\u30b8\u3092\u958b\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">https:\/\/github.com\/twbs\/bootstrap-rubygem<\/pre>\n<p>\u300cAdd Bootstrap dependencies and Bootstrap to your\u00a0<code>application.js<\/code>:\u300d\u3068\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u7b87\u6240\u306eJS\u3092\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<\/p>\n<p>\u300capp\/assets\/javascripts\/application.js\u300d\u306b\u4e0b\u8a18\u306e\u3088\u3046\u306b\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<div><\/div>\n<pre class=\"lang:default decode:true \">\/\/= require rails-ujs\r\n\/\/= require activestorage\r\n\/\/= require turbolinks\r\n\/\/= require jquery3\u3000\u2605\u30b3\u30d4\u30fc\u3057\u305f\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\r\n\/\/= require popper\u3000\u2605\u30b3\u30d4\u30fc\u3057\u305f\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\r\n\/\/= require bootstrap-sprockets\u3000\u2605\u30b3\u30d4\u30fc\u3057\u305f\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\r\n\/\/= require_tree .\r\n\r\n<\/pre>\n<h2>Rails\u30b5\u30fc\u30d0\u30fc\u3092\u518d\u8d77\u52d5\u3059\u308b\u3002<\/h2>\n<p>Rails\u30b5\u30fc\u30d0\u30fc\u3092\u518d\u8d77\u52d5\u3059\u308c\u3070bootstrap\u304c\u9069\u7528\u3067\u304d\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true  \">rails s<\/pre>\n","protected":false},"excerpt":{"rendered":"Rails\u306bBootstrap\u3092\u5c0e\u5165\u3059\u308b\u624b\u9806 Gemfile\u306b\u4e0b\u8a18\u5185\u5bb9\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002\uff08mini_racer\u306fautoprefixer-rails\u3068\u3044\u3046Gem\u306e\u52d5\u4f5c\u306b\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\uff09 gem 'bootstrap' ge [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[36],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7570"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7570"}],"version-history":[{"count":14,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7570\/revisions"}],"predecessor-version":[{"id":20541,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7570\/revisions\/20541"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7570"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}