application.css.scss not compiled on Rails 4 - ruby-on-rails

I felt strange that why the style not loaded,
So I wrote wrong content intentionally on application.css.scss,
And precompile and load the page didn't give me any error.
I thought the application.css.scss file must not be loaded and compiled.
Unfortunately, it seems no to be.
application.css.scss
#i2dmport "compass";
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require jquery.fileupload-ui
*= require dropzone/dropzone
*= require dropzone/basicdew
*= require_tree .
*/
#import "layout";
application.rb
config.autoload_paths += %W(#{Rails.root}/app/pdfs)
config.autoload_paths += %W(#{config.root}/lib/)
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
config.assets.paths << "#{Rails.root}/vendor/themes"
Gemfile (I not sure if there any conflict)
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.5'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.17.1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem "bootstrap-sass", "~> 3.1.1"
gem "compass-rails"
gem "therubyracer"
gem "execjs"
gem "hirb-unicode"
gem "devise", "~> 3.3.0"
gem "devise_ldap_authenticatable", "~> 0.6.1"
gem "net-ldap"
gem "will_paginate", "~> 3.0"
gem "rspec"
gem "awesome_print", require: "ap"
gem "tinymce-rails"
gem "simple_form"
gem "haml-rails"
gem "taps"
gem "analytics-ruby"
gem "bcrypt-ruby"
gem "bourbon"
gem 'cancancan', '~> 1.8'
gem "sunspot_rails"
gem "sunspot_solr"
gem "simple-navigation"
gem "simple-navigation-bootstrap"
#fast command
gem "spring", group: :development
#Handy tools for active record
gem "squeel", "~> 1.2.1" # Last officially released gem
# gem "squeel", :git => "git://github.com/activerecord-hackery/squeel.git" # Track git repo
gem 'prawn'
gem 'rb-readline', "~> 0.5.0.pre.1"
gem 'chartkick'
gem 'rails-erd', :group => :development
gem 'quiet_assets', group: :development
gem 'curb'
gem 'rest_client'
# only for assets not required in production mode
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jquery.fileupload-rails', "~> 1.10.0"
gem 'twitter-bootstrap-rails'
group :development do
gem "faker"
gem "rspec-rails"
gem "guard-rspec"
gem "pry"
gem "pry-remote"
gem "pry-nav"
gem 'pry-rescue'
gem 'pry-stack_explorer'
end
gem "paperclip", "~> 4.1"
gem 'dropzonejs-rails'
layout
!!!
%html
%head
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
= stylesheet_link_tag params[:controller]
= javascript_include_tag "application", "data-turbolinks-track" => true
= javascript_include_tag params[:controller], "data-turbolinks-track" => true

i had this exact same problem and was driving me crazy. i had a app/assets/stylesheets/mycustom_stylesheet.css.scss with the styles that loaded fine in development but when i deployed to production on heroku, none of my styles appeared. i solved it by placing the file custom.css in my vendor/assets/stylesheets directory with this content:
/*
*= require mycustom_stylesheet
*/
i also added this line to my initializers/assets.rb file although i'm not sure its necessary.
Rails.application.config.assets.precompile += %w( mycustom_stylesheet.css )

May be you have an "application.css" file inside of your "/vendor/themes/" or "/lib" folder ?
What happens if you remove this line "config.assets.paths << "#{Rails.root}/vendor/themes" from your application.rb file?

Try running below command
RAILS_ENV=production rake assets:precompile
or
RAILS_ENV=development rake assets:precompile

Today I came across a similar problem that changes in application.css.scss does not update in page styling. Later I found out that is because there is an error in my .scss file, ul being misspelled as u1. After the error is fixed, the styling finally updates in page refreshes, with no need to restart rails server.

Related

Couldn't find file 'foundation_and_overrides'

Hey when i type "rake assets:precompile" on terminal it shows error like this
I, [2016-05-05T13:52:42.537665 #11661] INFO -- : Writing /Users/paras/Hackathon_hackerearth/hackathon_1/public/assets/application-e73a0a56296d201e9779eb9ca13396a60e55ba64dee295f7fb3f1f39a64fee90.js
I, [2016-05-05T13:52:42.545034 #11661] INFO -- : Writing /Users/paras/Hackathon_hackerearth/hackathon_1/public/assets/application-e73a0a56296d201e9779eb9ca13396a60e55ba64dee295f7fb3f1f39a64fee90.js.gz
rake aborted!
Sprockets::FileNotFound: couldn't find file 'foundation_and_overrides' with type 'text/css'
/Users/paras/Hackathon_hackerearth/hackathon_1/app/assets/stylesheets/application.css:17
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
zlib(finalizer): Zlib::GzipWriter object must be closed explicitly.
zlib(finalizer): the stream was freed prematurely.`
My Gem file is here
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
gem 'pry'
#for password
gem 'bcrypt'
#for creating fake users
gem 'faker'
#for tagging
gem 'foundation-rails'
#for rating
gem 'ratyrate'
#for pagination
gem 'will_paginate'
gem 'bootstrap-will_paginate'
#bootstrap
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
#gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'rails_12factor', group: :production
ruby "2.3.0"
gem 'puma'
here is my application.js file's data
//= require jquery
//= require jquery_ujs
//= require foundation
//= require bootstrap
//= require_tree .
$(function(){ $(document).foundation(); });
and here is my application.css file
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*= require foundation_and_overrides
*/
please tell me that what is wrong with it. i searched it but no hint could solve this error. i am working on OS X El Capitan.
Do you have a CSS file whose name starts with foundation_and_overrides in your assets/stylesheets folder?
It can't find it.

Why am I getting *unmatched OUTDENT* in this haml template in Rails 4.2 application?

I've been playing with react-rails gem and so I made a sample application with haml. When I do rails s and go to my sample route, I see the attached error coming from application.html.haml, the standard layout/application.html.haml view in Rails 4.2. If I remove stylesheet_link_tag and javascript_include_tag the Rails view renders fine. What could be causing it? Below are the relevant files. There is also a sample.coffee file but I can't imagine that has anything to do with it since as soon as I remove the *_tag helpers the Rails view renders without error.
application.js.coffee
# This is a manifest file that'll be compiled into application.js, which will include all the files
# listed below.
#
# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
# or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
#
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
# compiled file.
#
# Read Sprockets README (https:#github.com/rails/sprockets#sprockets-directives) for details
# about supported directives.
#
#= require jquery
#= require jquery_ujs
#= require react
#= require react_ujs
#= require components
#= require_tree .
application.html.haml
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title SampleApp
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'application'
= csrf_meta_tags
%body
= yield
application.css
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.2.5'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'react-rails', '~> 1.6.0'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'httparty'
gem 'haml-rails'
gem 'annotate'
gem 'figaro'
gem 'pundit'
gem 'lol_dba', require: false
gem 'foreman'
gem 'newrelic_rpm'
group :development do
gem 'sextant'
gem 'awesome_print', require: false
gem 'hirb', require: false
gem 'bullet'
gem 'flog', require: false
gem 'flay', require: false
gem 'reek', require: false
gem 'derailed'
gem 'stackprof'
gem 'sandi_meter'
gem 'rubocop', require: false
end
group :development, :test do
gem 'spring-commands-rspec'
gem 'rspec-rails'
gem 'guard-rspec'
gem 'pry'
end
group :test do
gem 'factory_girl_rails'
gem 'capybara'
gem 'database_cleaner'
gem 'launchy'
gem 'codeclimate-test-reporter', require: nil
gem 'shoulda-matchers', require: false
end
group :production, :staging do
gem 'rails_12factor'
gem 'puma'
end

Deploy masonry in Heroku

Good day,
I made an app with masonry and js.coffee to make something like "pins" in my app, but when I deploy to Heroku don't work like suppose to do.
This is my gem file
source 'https://rubygems.org'
ruby '2.1.4'
gem 'binding_of_caller'
gem 'masonry-rails', '~> 0.2.0'
gem 'haml'
gem 'high_voltage', '~> 2.3.0'
gem 'activevalidators'
gem 'paperclip', github: 'thoughtbot/paperclip'
gem 'simple_form', '~>3.0.2'
gem 'acts_as_votable'
gem 'bootstrap-sass'
gem 'devise', '~> 3.4.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :assets do
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootstrap-rails'
gem 'libv8'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'sqlite3'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
My application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require bootstrap-sprockets
//= require masonry/jquery.masonry
//= require turbolinks
//= require_tree .
My js.coffee to show pins
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$ ->
$('#pins').imagesLoaded ->
$('#pins').masonry
itemSelector: '.box'
isFitWidth: true
My index for pins
- content_for :board do
= javascript_include_tag 'application', 'data-turbolinks-track' => true
#pins.transitions-enabled
- #pins.each do |pin|
.box.panel.panel-default
= link_to (image_tag pin.image.url), pin
%h2
= link_to pin.title, pin
%p.user
Ofertado por
= pin.user.name
%p.price
$
= pin.price
Am I doing something wrong?
If it works well under development and won't work upon deployment in heroku, you might have mistakenly configured your database.yml under config.
production:
adapter: postgresql
encoding: utf8
database: (copy database name from your heroku database info)
username: (copy username from your heroku database info)
password: TV9ncj-HR1FqNFihKm6zlsHhxU
host: (copy host from your heroku database info)
sslmode: require
and don't forget to do the rake db:migrate
if this is not the answer you were looking for, this might still be a little useful for you, if not now, maybe in the near future as you go along with your code.

File to import not found or unreadable: bootstrap-sprockets

I am trying to install bootstrap into my application and am having all kinds of problems. I have pasted my gemfile, application.js and error codes. I am not sure what I am doing wrong here and any help would be greatly appreciated.
styles.css.scss
// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
#import "bootstrap-sprockets";
#import "bootstrap";
gem file
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
group :development do
gem 'sqlite3'
gem 'capistrano'
end
group :production do
gem 'pg'
gem 'mysql2'
gem 'activerecord-mysql-adapter'
end
# Use SCSS for stylesheets
group :assets do
gem 'coffee-rails'
gem 'bootstrap-sass', '~> 3.3.3'
gem 'sass-rails', '>= 3.2'
end
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require bootstrap-sprockets
this is my error
WARN: tilt autoloading 'sass' in a non thread-safe way; explicit require 'sass' suggested.
Completed 500 Internal Server Error in 722ms
ActionView::Template::Error (File to import not found or unreadable: bootstrap-sprockets.
Load paths:
C:/Sites/jeepjig/app/assets/images
C:/Sites/jeepjig/app/assets/javascripts
C:/Sites/jeepjig/app/assets/stylesheets
C:/Sites/jeepjig/vendor/assets/javascripts
C:/Sites/jeepjig/vendor/assets/stylesheets
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.2/lib/assets/javascripts
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/jquery-rails-3.1.2/vendor/assets/javascripts
(in C:/Sites/jeepjig/app/assets/stylesheets/styles.css.scss:2)):
3: <head>
4: <%= tag :meta, name: "viewport", content: "width=device-width, initial-scale=1.0" %>
5: <title>JeepJig</title>
6: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
7: <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
8: <%= csrf_meta_tags %>
9:
app/assets/stylesheets/styles.css.scss:2
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__1034748832_48995988'
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templ
ates/rescues/_trace.html.erb (3.0ms)
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templ
ates/rescues/_request_and_response.html.erb (2.0ms)
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templ
ates/rescues/template_error.html.erb within rescues/layout (53.0ms)
Update:
I removed
group :assets do
and now I am not longer getting the error.
I guess this was depreciated in R4
I found this link, quickly realized I was having the issue because I had installed the boostrap-sass, and done a bundled install without restarting the rails server.
I hope to provide this as a reminder for any others that find their way here and can't see why it's not working.
remove group :assets in Gemfile whereas specify like this
gem 'bootstrap-sass', :git => 'https://github.com/twbs/bootstrap-sass.git', :branch => 'next'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'autoprefixer-rails'

Rails: Can't include scss in rails 4.1.1. - TypeError: Object doesn't support this property or method

Edit: The solution was to lock sass-rails gem to 4.0.2 version.
I have a wierd problem this afternoon.
I was trying to implement a bootstrap theme (Detail admin) but when included in application.css.scss I got an error:
TypeError: Object doesn't support this property or method
(in C:/sites/busapp/app/assets/stylesheets/application.css.scss)
I tried changinh extension of my file to only .css or only .scss but it didn't work. I'm now trying 2h30min so I'm getting desperate and asking if someone else knows how to solve this.
OS: Windows 8.1 64bit
Ruby 1.9.3p545
Rails 4-1.1
My gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'jquery-turbolinks'
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
#====Custom gems====
group :development do
gem 'better_errors'
gem 'pry-rails'
gem 'rails_debug'
# gem 'quiet_assets'
gem 'letter_opener'
end
#Database
gem 'pg'
#Slim
gem 'slim'
gem 'slim-rails'
#Bootstrap
gem 'bootstrap-sass'
gem 'autoprefixer-rails'
#Authentication
gem 'devise'
#Other
gem 'simple_form', '~> 3.1.0.rc1'
# gem 'will_paginate-bootstrap'
# gem 'enumerations'
# gem 'will_paginate-bootstrap'
# gem 'acts_as_simple_translatable'
# gem 'paperclip', '~> 4.1'
# gem 'active_model_serializers'
# gem 'font-awesome-sass'
# gem 'apipie-rails'
# gem 'cancancan', '~> 1.9'
# gem 'redcarpet', '~> 3.1.2'
# gem 'bazaar', '0.0.2'
# gem 'memoist', '0.9.1'
Application.css.scss
#import "bootstrap-sprockets";
#import "bootstrap";
#import "neki";
application.html.slim
doctype html
html
head
title Busapp
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
body
= link_to destroy_user_session_path, method: :delete, class: "btn"
| Logout
= render "layouts/flash"
= yield
Also, when I remove only the last file from application.css.scss I don't get an error. And it's not due to file being corrupt because I've tried with multiple ones and in this one is only body backround color set to red.
Another thing that might be relevant is what happens when I run bundle update: http://prntscr.com/4i0xfl
Edit: Even when I try to add something like this directly to my .css.scss it still breaks.
body {background-color: red;}
Don't know for sure, but will just update previous wrong answer with various suggestions which maybe already where tried:
1)
Found this similar issue: github.com/activeadmin/activeadmin/issues/3093 where the solution was to update some gems
2)
And based on the provided output of the screenshot found this: github.com/sstephenson/sprockets/issues/540 where the solution was to precompile the assets (namely bootstrap).. looks like it's a sprocket bug.
3)
And for the railties-dependency error various approaches on SO: stackoverflow.com/questions/17327953/rails-4-0-0-bundler-could-not-find-compatible-versions-for-gem-railties
Looks like you've already solved the problem, but I struggled with this problem yesterday and came upon a decent solution (workaround?), so I wanted to share it.
I'm running Rails 4.1.1 on Windows 7.
I would get an ExecJS Runtime Error with the bootstrap-sass gem, but not with twitter-bootstrap gem (no preprocessor).
Quick 2-step workaround.
Rename application.css.scss --> application.css
create a new file custom.css.scss to hold the code that was previously in application.css.scss
Problem Solved!
Source:
https://www.railstutorial.org/book/filling_in_the_layout#sec-custom_css

Resources