Rails beginner here !
I'm trying to load .js files through the asset pipeline. As mentioned in Rails Guides:
2.2.1 Search Paths
When a file is referenced from a manifest or a helper, Sprockets searches the three default asset locations for it.
The default locations are: the
images,javascriptsandstylesheetsdirectories under theapp/assets
Whenever I run rails new my_project, Rails doesn't generate the app/assets/javascripts directory, nor the related manifesto:
app/assets/
├── config
│ └── manifest.js
├── images
└── stylesheets
└── application.css
I've manually added the /app/assets/javascripts directory and the application.js file. Here is its content:
//= require mytheme/js/test # a simple alert('test')
//= require rails-ujs
//= require turbolinks
//= require_tree .
//= require mytheme/js/file1 # for each file of my theme
but no alert pops up. However, using the 'Network' tab of the browser's Inspect Mode shows me that there's a .js file (nothing related to my theme though).
Should I conclude that Rails is using another manifesto to load .js files ? Pragmatically, how could I ask the Asset Pipeline to load specific .js files ?
Long post of a beginner question, thanks for your time.
NOTE: Path should be ok, as my css is using the same path and is loading. I've also added
Rails.application.config.assets.paths << Rails.root.join('vendor') to config/initializers/assets.rb