rweng / jquery-datatables-rails

jquery-datatables gem for rails
MIT License
564 stars 338 forks source link

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

Open mcshakes opened 9 years ago

mcshakes commented 9 years ago

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.

jh125486 commented 9 years ago

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.

anquinn commented 9 years ago

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

jh125486 commented 9 years ago

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

anquinn commented 9 years ago

["/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"]

jh125486 commented 9 years ago

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

anquinn commented 9 years ago

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.

ariawanzero commented 7 years ago

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 commented 7 years ago

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