{"id":7878,"date":"2019-12-04T21:37:15","date_gmt":"2019-12-04T12:37:15","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=7878"},"modified":"2023-05-21T11:43:37","modified_gmt":"2023-05-21T02:43:37","slug":"%e3%80%90ruby-on-rails%e3%80%91%e3%82%a2%e3%82%bb%e3%83%83%e3%83%88%e3%81%ae%e8%a8%ad%e5%ae%9a%e3%83%95%e3%82%a1%e3%82%a4%e3%83%abassets-rb","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=7878","title":{"rendered":"\u3010Ruby on Rails\u3011\u30a2\u30bb\u30c3\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb(assets.rb\u3001config\/environments)"},"content":{"rendered":"<p>\u30a2\u30bb\u30c3\u30c8\u95a2\u9023\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306f\u4e0b\u8a18\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u308a\u307e\u3059\u3002\u30a2\u30bb\u30c3\u30c8\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u306e\u8a2d\u5b9a\u3092\u3057\u305f\u3044\u5834\u5408\u306f\u3057\u3063\u304b\u308a\u7406\u89e3\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>config\/initializers\/assets.rb<\/h2>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u5168\u3066\u306e\u74b0\u5883\u3067\u8aad\u307f\u8fbc\u307e\u308c\u308b\u305f\u3081\u74b0\u5883\u5171\u901a\u306e\u8a2d\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">Rails.application.config.assets.version = '1.0'<\/pre>\n<p>\u4e0a\u8a18\u8a2d\u5b9a\u306f\u30a2\u30bb\u30c3\u30c8\u306b\u5bfe\u3059\u308b\u30c0\u30a4\u30b8\u30a7\u30b9\u30c8\u306e\u751f\u6210\u306b\u95a2\u308f\u3063\u3066\u3044\u307e\u3059\u3002\u9006\u306b\u3044\u3048\u3070<span style=\"color: #ff0000;\"><strong>\u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3067\u30a2\u30bb\u30c3\u30c8\u3092\u5f37\u5236\u7684\u306b\u671f\u9650\u5207\u308c\u306b\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">Rails.application.config.assets.paths &lt;&lt; Rails.root.join('node_modules')<\/pre>\n<p>\u3053\u308c\u306f\u63a2\u7d22\u30d1\u30b9\u306e\u8a2d\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002\u521d\u671f\u72b6\u614b\u3067\u306f<span style=\"color: #ff0000;\"><strong>yarn\u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u306enode_modules\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u8ffd\u52a0\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/strong><\/span><\/p>\n<pre class=\"lang:default decode:true \"># Rails.application.config.assets.precompile += %w( admin.js admin.css )<\/pre>\n<p>\u4e0a\u8a18\u8a2d\u5b9a\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30d7\u30ea\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u914d\u5217\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<span style=\"color: #ff0000;\"><strong>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fapplication.js\u3001application.css\u3001app\/assets\u914d\u4e0b\u306eJS\u3001CSS\u4ee5\u5916\u306e\u5168\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u5bfe\u8c61\u3068\u306a\u3063\u3066\u3044\u308b<\/strong><\/span>\u306e\u3067\u305d\u308c\u4ee5\u5916\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30d7\u30ea\u30b3\u30f3\u30d1\u30a4\u30eb\u5bfe\u8c61\u3068\u3057\u305f\u3044\u5834\u5408\u306b\u3053\u3061\u3089\u306e\u8a2d\u5b9a\u3092\u3044\u3058\u308a\u307e\u3059\u3002<\/p>\n<h2>config\/environments\/\u5404\u30d5\u30a1\u30a4\u30eb<\/h2>\n<p>\u74b0\u5883\u5225\u306e\u30a2\u30bb\u30c3\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u8a2d\u5b9a\u5024<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>config.assets.debug<\/td>\n<td>\u30a2\u30bb\u30c3\u30c8\u306e\u9023\u7d50\u3084\u524d\u51e6\u7406\u3092\u884c\u308f\u306a\u3044\u304b\u3002\u884c\u308f\u306a\u3044\u5834\u5408\u306f\u51e6\u7406\u901f\u5ea6\u306f\u4e0a\u304c\u308a\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>config.assets.quiet<\/td>\n<td>\u30a2\u30bb\u30c3\u30c8\u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u95a2\u3059\u308b\u30ed\u30b0\u51fa\u529b\u3092\u6291\u5236\u3059\u308b\u3002\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30ed\u30b0\u306f\u5927\u91cf\u306b\u51fa\u308b\u306e\u3067\u30ed\u30b0\u306e\u8996\u8a8d\u6027\u304c\u4e0a\u304c\u308a\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>config.assets.js_compressor<\/td>\n<td>JS\u3084CSS\u306e\u5727\u7e2e\u65b9\u6cd5\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002(\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fproduction\u74b0\u5883\u306e\u307f\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\uff09<\/td>\n<\/tr>\n<tr>\n<td>config..assets.compile<\/td>\n<td>\u30d7\u30ea\u30b3\u30f3\u30d1\u30a4\u30eb\u3092\u3059\u308b\u304b\u3069\u3046\u304b\u3002\u958b\u767a\u6642\u306b\u306f\u30e1\u30e2\u30ea\u6d88\u8cbb\u91cf\u306f\u5897\u3048\u308b\u304c\u4fbf\u5229\u3002<\/td>\n<\/tr>\n<tr>\n<td>config.action_controller.asset_host<\/td>\n<td>\u30a2\u30bb\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u914d\u4fe1\u30b5\u30fc\u30d0\u3092\u8a2d\u5b9a\u3002CDN\u7b49\u3092\u4f7f\u3046\u5834\u5408\u306f\u3053\u308c\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"\u30a2\u30bb\u30c3\u30c8\u95a2\u9023\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306f\u4e0b\u8a18\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u308a\u307e\u3059\u3002\u30a2\u30bb\u30c3\u30c8\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u306e\u8a2d\u5b9a\u3092\u3057\u305f\u3044\u5834\u5408\u306f\u3057\u3063\u304b\u308a\u7406\u89e3\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 config\/initializers\/assets.rb \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u5168\u3066\u306e\u74b0\u5883\u3067\u8aad [&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\/7878"}],"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=7878"}],"version-history":[{"count":7,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7878\/revisions"}],"predecessor-version":[{"id":19757,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7878\/revisions\/19757"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7878"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}