app/assets/ directory and instead have been moved into a separate directory
If you look at
You can set this up by adding a custom directory within the
custom/, and then require the files within in
home.js in the
Since it's required in
application.js file that looks something like
This is loaded by the
app/views/layouts/application.html.erb, automatically created when you make a new Rails app.
index.js and require it with a simple reference to the directory like
require() looks for an
index.js file when given a path to a directory (if there is no
index.js, it will fail).
For example, if you have a file named
application.js with everything else, you can get Rails to compile it into a separate file, or "pack."
To do so, add a custom file within
custom.js, then use the
custom.js that looks something like this:
body tag in the
Thanks for reading!