Answer the question
In order to leave comments, you need to log in
The js code is included 2 times in application.js and in its file (?
app
..assets
....javascripts
......application.js
......somecode.js
app/assets/javascripts/application.js /app/views/layouts/application.html.haml
in output in public/assets I expect application.js, but I get application.js and somecode.js. And in the page code I see://=require somecode
= javascript_include_tag 'application'
<script src="/assets/somecode-3b9fe45f9d9a8007fa4c213cfbced5fd.js?body=1"></script>
<script src="/assets/application-3b9fe45f9d9a8007fa4c213cfbced5fd.js?body=1"></script>
Answer the question
In order to leave comments, you need to log in
In addition to vsuhachev ,
replace
/config/environments/development.rb with
If you want to have what you want in the development environment :)
PS not necessarily if the file is located in and there is a line in application.js//=require somecode
/app/assets
//= require_tree .
firstly, it matters what environment you are in, in development this behavior is normal, and assets for production are collected using the assets:precompile task;
secondly, by default, the manifest (application.js) usually has a require_tree command that includes all files from subdirectories, those. require somecode is not needed,
read here how it all works
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question