2

The default Rails 3.2 application.html.erb is this:

<!DOCTYPE html>
<html>
<head>
  <title>Testapp</title>
  <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
  <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>

Is there a way to inline the asset pipeline generated CSS and JavaScript here?

PS: No need to lament that inlining could be a bad idea.

1 Answer 1

1

In your layout template, replace

<%= javascript_include_tag 'application' %>

with,

<script type="text/javascript">  
<%= Rails.application.assets.find_asset('application.js').body.html_safe %>
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.