A
A
Anton Misyagin2016-07-19 06:33:25
Ruby on Rails
Anton Misyagin, 2016-07-19 06:33:25

How to include resource in application.js depending on environment?

application.js:

//=require video
//=require slider
//=require search
//=require page-loading
if Rails.env.production?
//=require no_debug
end
//=require account

I want the anti-debugger script to be enabled only in production. How to do this, but only without including it in the layout with the if Rails.env.production check??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kane, 2016-07-24
@Kane

Rename application.js file to application.js.erb:

<% if Rails.env.production? %>
//=require no_debug
<% end %>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question