After following this angular tutorial, I'm trying to deploy to heroku. I'm getting the error:
rake aborted!
require_tree argument must be a directory
The tutorial instructed me to the remove the line //= require tree . from application.js. When I add it back for heroku deployment, it breaks my app. Is there any workaround so I don't have to include //= require_tree .?
I've tried adding //= require_tree ./mobile and creating /mobile stub directory with a single file so it would commit. Didn't work.
Edit:
application.js
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require angular
//= require ng-infinite-scroll.min.js
//= require angular-ui-router.min.js
//= require ng-rails-csrf
My angular app config file:
#= require_self
#= require_tree ./services/global
#= require_tree ./services/main
#= require_tree ./filters/global
#= require_tree ./filters/main
#= require_tree ./controllers/global
#= require_tree ./controllers/main
#= require_tree ./directives/global
#= require_tree ./directives/main
Not sure if it's relevant, but my application.css.scss file includes *= require_tree .
Your application.js looks good. You should now look into all the directories that your angluar.js config files is trying to load. Look for directories that are empty. Git does not create a physical directory if a directory is empty. Hope this helps.
Related
In my javascript console it works when I do this$('.collapse').collapse();,
but it does not work when I append it to the bottom of my application.js file.
My application.js file looks like this
//= require rails-ujs
//= require activestorage
//= require turbolinks
//= require jquery3
//= require popper
//= require bootstrap
//= require_tree .
Why doesn't it work when I add it to my application.js???
Thank you
I am using jquery datepicker for my active admin. I upgraded my app from rails 4.6 to rails 5 then my app started to fail.
couldn't find file 'jquery-ui/datepicker' with type 'application/javascript'
I added gem 'jquery-ui-rails' gem and added //= require jquery-ui in application.js and *= require jquery-ui but still my problem didn't solved.
application.js
//= require_self
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require jquery-ui/widgets/datepicker
in your application.js
//= require jquery-ui/widgets/datepicker
and restart your server
Update:
Rearrange your js as following and restart your server.
//= require_self
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require jquery-ui/widgets/datepicker
//= require_tree .
You may need to upgrade your 'active_admin_datetimepicker', so try to update your Gemfile with:
gem 'active_admin_datetimepicker', '=0.6.3'
I am trying to load bootstrap in my rails application. But it is not working. I had included the bootstrap and sass gems in my Gemfile. The following is my application.js file:
//= require bootstrap
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
I have also tried using bootstrap-cdn but it did not solve my problem. And I am unable to load bootstrap.min file in the application.
Thanks in advance.
Add .min after bootstrap or rails will search for bootstrap.js instead of bootstrap.min.js
//= require bootstrap.min
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
NOTE: Same applies for bootstrap.min.css
**
Sprockets::FileNotFound at /
couldn't find file 'ckeditor-jquery'
(in /home/jeeva/Projects/Codebases/acu-arogya/app/assets/javascripts/application.js:16)
**
I am Using CKeditor in my rails application but i'm getting error in javascript
My application.js file contains:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require ckeditor-jquery
//= require twitter/bootstrap
//= require_tree .
One simple idea to try:
Swap the position of
//=require_tree .
with the position of
//= require ckeditor-jquery
I'm trying to add jquery ui datepicker to my application with help of jquery-ui-rails gem. I've checked Railscast I seem to do everything right, but i get an error upon application startup
couldn't find file 'jquery.ui.all'
Gemfile(end of it, tried to include gem in the assets group but no luck):
gem 'backbone-on-rails'
gem "jquery-ui-rails"
application.js
//= require jquery
//= require jquery_ujs
//= require underscore
//= require backbone
//= require svitla_test
//= require_tree ../templates
//= require_tree ./models
//= require_tree ./collections
//= require_tree ./views
//= require_tree ./routers
//= require_tree .
//= require jquery.ui.all
application.css
*= require jquery.ui.all
*= require_self
*= require_tree .
At version 5.0 it has been changed. You can read more about it here.
version 5.0:
application.js:
//= require jquery-ui
application.css:
/*
*= require jquery-ui
*/
version 4.x (I'm sure about 4.2.0 and 4.2.1):
application.js:
//= require jquery.ui.all
application.css:
/*
*= require jquery.ui.all
*/
Put //= require jquery.ui.all right after //= require jquery so it will look like this
//= require jquery
//= require jquery.ui.all
//= require jquery_ujs
//= require underscore
//= require backbone
//= require svitla_test
//= require_tree ../templates
//= require_tree ./models
//= require_tree ./collections
//= require_tree ./views
//= require_tree ./routers
//= require_tree .
note that the order of which these lines are written is the order which these files are loaded.. So if you call a jquery-ui function before it knows what jquery-ui is, most likely you need to change the order a bit..
It is usually good to put infrastructure files before your own files to avoid these kind of problems