opal / opal-rails

Bringing Ruby to Rails · Rails bindings for Opal
http://opalrb.com/#getting-started-rails
488 stars 65 forks source link

Does not add fingerprinting to assets #90

Closed maclarensg closed 7 years ago

maclarensg commented 8 years ago

I've use Rails5 and I found that fingerprinting of assets

I've also raised a topic in StackOverflow. http://stackoverflow.com/questions/38735533/opal-rails-in-rails-5-does-not-add-fingerprinting-to-assets

mindaslab commented 7 years ago

This bug still exists. https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/rubyonrails-talk/QpNzm69aPxg/x6Jy1_d8AQAJ

mindaslab commented 7 years ago

@maclarensg did you find out a solution for this problem? Or have we done something wrong?

elia commented 7 years ago

@maclarensg @mindaslab finally got to dig into this issue, and it's simply due to the fact that opal-rails pins the sprockets-rails version to < 3, while one of the changes in v2 vs v3 is that in v3 Rails.applicaiton.config.assets.digest defaults to true.

I'll leave this open until I fix support for sprockets-rails v3.

mindaslab commented 7 years ago

Thanks a lot @elia I was thinking I left out this config

# Compiler options
Rails.application.config.opal.method_missing           = true
Rails.application.config.opal.optimized_operators      = true
Rails.application.config.opal.arity_check              = !Rails.env.production?
Rails.application.config.opal.const_missing            = true
Rails.application.config.opal.dynamic_require_severity = :ignore

in assets.rb. But I have thrown off the old code so I can't verify and am not sure. Any way thanks a lot for digging in :)

elia commented 7 years ago

Closing this, I realized it's a duplicate of #82

mindaslab commented 7 years ago

@elia This bug seems to be there, this is what I used in my gem file

gem 'opal-rails', git: "git@github.com:opal/opal-rails.git"

And this is the HTML output I got when I ran in production

<!DOCTYPE html>
<html>
  <head>
    <title>OpalLinkTest</title>
    <meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="68Kp390wKUQqhnS06LM8XgH5aOPXnLKW0GkDAnmb3bTb2/R9t0X6dmvPRH/wiEIBB7cL+yJNlstTMiaFy8q7qQ==" />

    <link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="reload" />
    <script src="/assets/application.js" data-turbolinks-track="reload"></script><script>
//<![CDATA[
if (typeof(Opal) !== 'undefined') { Opal.loaded(["opal","corelib/runtime.self","jquery.self","jquery_ujs.self","turbolinks.self","action_cable.self","cable.self"]); Opal.load("application"); }
//]]>
</script>
  </head>

  <body>
    <h1>Home#index</h1>
<p>Find me in app/views/home/index.html.erb</p>
<a href="/home/about">About</a>

  </body>
</html>
elia commented 7 years ago

@mindaslab it shouldn't be an issue anymore with the latest release, but the solution proposed in #82 I was referring to is in this comment: https://github.com/opal/opal-rails/issues/82#issuecomment-232549756

let me know if this needs to be reopened