Reputation: 3110
I'm using Sprockets
and I want to add require from parent folder into my application.js
,
So I've tried this :
//= require ../plugins/adminlte/plugins/datatables/dataTables.bootstrap
but it doesn't work I get
Sprockets::FileNotFound
this is the path of file I want to import :
-lib/assets/plugins/adminlte/plugins/dataTables.bootstrap.js
Upvotes: 1
Views: 1972
Reputation: 3618
My solution to the same problem was to explicitly add the directory to the assets path in application.rb
:
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
config.assets.paths << Rails.root.join('app/assets/the_folder')
I could then import the required file without having to reference the folder:
*
*= require 'the_asset.scss'
*= require_tree .
*= require_self
*/
Upvotes: 1
Reputation: 14282
Any folder created directly under assets will be added to the load paths. So you just have to use //=require adminlte/plugins/dataTables.bootstrap.js
Upvotes: 0