RailsApps / learn-rails

An example Rails 5.1 app to accompany the "Learn Ruby on Rails" book.
https://learn-rails.com/install-rails-mac/index.html
392 stars 266 forks source link

Asset pipeline issue #55

Closed shails closed 9 years ago

shails commented 9 years ago

In the section Layout and Views , its mentioned - "Create as many files as you need to organize your JavaScript or CSS code and you’ll automatically get one single file delivered to the browser."

But as I was checking my webpage via "View Page Source " of firefox I see following - Too many javascript links and c

<!DOCTYPE html>
 <html>
 <head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Foobar Kadigan</title>
 <meta name="description" content="Website of Foobar Kadigan">
 <link rel="stylesheet" media="all" href="/assets/framework_and_overrides-9664b1af1d54f8f3cd4dff3856f5fe5f.css?body=1" data-turbolinks-track="true" />
   <link rel="stylesheet" media="all" href="/assets/application-655842737481a2e20004e8bc70393fc4.css?body=1" data-turbolinks-track="true" />
<script src="/assets/vendor/modernizr-ab036539ab2eac66b636accb8d06d77b.js?body=1">         </script>
    <script src="/assets/jquery-87424c3c19e96d4fb033c10ebe21ec40.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/jquery_ujs-e27bd20a10d28155845a22d71ef94f2f.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/turbolinks-f87b3583ca50adb0488b031297f5580d.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation-013a9ecfcbd0d277665f83c66e076e18.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.abide-cecd3b8dfdb9535c145e3160cca57cae.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.accordion-07d483c126d868809345e4abbcfd54a5.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.alert-e54c2d9000574a39e07b2e6ede6ae0f6.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.clearing-b0828edefaad3278cd85c2faf6fd20ef.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.dropdown-c6b22cf8e5474c59dc0bc19e2d290da5.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.interchange-adf4ca4cb9a1f36677701d7d06489ead.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.joyride-7f23c30298ef55f2db505f357bd4a799.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.magellan-8cd3c13f48f6d78fb172bb5200551918.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.offcanvas-0c2112e52f2de840e27058c4912dd869.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.orbit-925ec65dcf6be03dd5c7a1d472845b27.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.reveal-7bd8d9ca180151af16ff7678033f8212.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.slider-66a6fcccc01097ba84b9e9fb84a429ef.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.tab-0d9dd6504af28bc75bdb999fbb120872.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.tooltip-5214a0ecffb0be84dc9247c31455ef50.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.topbar-ba04adaaf787a047a2bc9195842bb938.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation/foundation.equalizer-b93ba11c4146c58dd7d95ba14769e640.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/foundation-cf9c2be01a146b330f05b712f6779903.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/application-10b6cbf7661fd055f30f0aba6dd7e6e5.js?body=1" data-turbolinks-track="true"></script>
    <meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="Ds7L/yFOiWhhvnogborI2rCLX4lJPWhiqmelhb5fVISXwxP4n1moC0i/1AZPpMumv4Aox/7S2Xqc9P/aKDPNxg==" />
  </head>
  <body>```
cenan commented 9 years ago

I think it is because you are on development. You'll get a single file when you run on production environment.

DanielKehoe commented 9 years ago

Thanks for raising this issue. I've updated the next edition of the book to clarify this point. In production, you'll automatically get one single file delivered to the browser. In development mode, Rails continues to deliver multiple files for easier debugging.