jquery-datatables-rails icon indicating copy to clipboard operation
jquery-datatables-rails copied to clipboard

couldn't find file 'dataTables/bootstrap/3/jquery.dataTables.bootstrap' with type 'text/css'

Open mcshakes opened this issue 9 years ago • 8 comments

Hey, trying to add Bootstrap 3 and Datatables together.

Here is my gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.1' gem 'pg' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' gem 'bootstrap-sass', '~> 3.3.4' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc gem 'mocha'

gem 'bcrypt', '~> 3.1.7' gem 'jquery-datatables-rails', '~> 1.12.2'

group :development, :test do gem 'byebug' gem 'pry' gem 'better_errors' gem 'binding_of_caller' gem 'capybara' gem 'web-console', '~> 2.0' gem 'spring' gem 'launchy' gem 'database_cleaner' gem 'minitest-rails-capybara' end

application.js

//= require jquery //= require jquery_ujs //= require dataTables/jquery.dataTables //= require dataTables/bootstrap/3/jquery.dataTables.bootstrap //= require bootstrap-sprockets //= require jquery-ui //= require turbolinks //= require_tree .

and application.css

*= require_tree . *= require_self *= require dataTables/jquery.dataTables *= require dataTables/bootstrap/3/jquery.dataTables.bootstrap

*= require_directory .

Do I have to instead put those within application.css in application.scss for it to work properly?

Thanks.

mcshakes avatar May 11 '15 02:05 mcshakes

Since the stylesheets are .scss, you'll have to put the extension like *= require dataTables/bootstrap/3/jquery.dataTables.bootstrap.scss If you are using the Bootstrap 3 stylesheets, don't load the dataTables/jquery.dataTables stylesheet; it conflicts as I recall.

Also, you probably need to do a *= require bootstrap to get the base Bootstrap 3 stylesheets loaded.

jh125486 avatar May 11 '15 14:05 jh125486

same error here. It doesn't seem to actually be installing the files anywhere, just adding the require lines.

anquinn avatar Jul 09 '15 23:07 anquinn

Can you run Rails.application.config.assets.paths from rails console and paste what's there?

jh125486 avatar Jul 10 '15 16:07 jh125486

["/Users/andrew/Projects/targets_dashboard/app/assets/images", "/Users/andrew/Projects/targets_dashboard/app/assets/javascripts", "/Users/andrew/Projects/targets_dashboard/app/assets/stylesheets", "/Users/andrew/Projects/targets_dashboard/vendor/assets/javascripts", "/Users/andrew/Projects/targets_dashboard/vendor/assets/stylesheets", "/Users/andrew/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jquery-datatables-rails-3.3.0/app/assets/images", "/Users/andrew/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jquery-datatables-rails-3.3.0/app/assets/javascripts", "/Users/andrew/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jquery-datatables-rails-3.3.0/app/assets/media", "/Users/andrew/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jquery-datatables-rails-3.3.0/app/assets/stylesheets", "/Users/andrew/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/turbolinks-2.5.3/lib/assets/javascripts", "/Users/andrew/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jquery-rails-3.1.3/vendor/assets/javascripts", "/Users/andrew/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/coffee-rails-4.0.1/lib/assets/javascripts"]

anquinn avatar Jul 11 '15 15:07 anquinn

Hrmm, it shows to be adding the correct paths for jquery-datatables-rails... which gem are you loading up for the Bootstrap assets?

jh125486 avatar Jul 14 '15 18:07 jh125486

I'm manually loading a custom build of the core bootstrap. I get the same error when I tried with the vanilla version of datatables (different path of course) . The only way I found around it was to manually copy the assets (css, js, images) into the pipeline directory.

anquinn avatar Jul 14 '15 18:07 anquinn

i want to ask anyone who can import this style on .css.scss file because i'm always get error in this import like @import dataTables/bootstrap/3/jquery.dataTables.bootstrap

ariawanzero avatar May 18 '17 03:05 ariawanzero

yeah i'm already get the solution like this @import "dataTables/bootstrap/3/jquery.dataTables.bootstrap.scss";

ariawanzero avatar May 18 '17 03:05 ariawanzero