Can't localize line error when compiling assets - ruby-on-rails

I'm getting an error when pushing to heroku when compiling assets...
I've revised every single CSS in order to localize any error but nothing...
The thing is
it's telling me the line of the compiled file, but I need to know the line number of the error before compiling... Any ideas of how can I fix this? Thanks!
The error when pushing:
Running: rake assets:precompile
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
I, [2014-06-27T11:43:08.802691 #1716] INFO -- : Writing /tmp/build_6b3b977d-af90-4ecf-9f85-03999c81089c/public/assets/application-ccf6af846f884c868c81901ada8cf44b.js
rake aborted!
Invalid CSS after " color: #333;}": expected "}", was ""
(in /tmp/build_6b3b977d-af90-4ecf-9f85-03999c81089c/app/assets/stylesheets/application.css)
(sass):6836

Related

Rails test parallelization not working with custom PG text search config

When I use parallelize(workers: :number_of_processors) for my tests this error occurs :
DRb::DRbRemoteError: PG::UndefinedObject: ERROR: text search configuration "french_custom" does not exist
LINE 1: ...earch" tsvector GENERATED ALWAYS AS ((to_tsvector('french_custom...
I tried to force tsearch config on database fork with parallelize_setup, but it's not even called

Error compiling assets after upgrading bootstrap

I'm trying to upgrade the bootstrap version in a Ruby on Rails application. After migratinng from 4.0.0-alpha.6 to 4.1 using yarn I get this error when running rails assets:precompile
error
SassC::SyntaxError: Error: Undefined variable: "$alert-warning-bg".
on line 32:20 of app/assets/stylesheets/variables/_helpers.scss
from line 47:9 of app/assets/stylesheets/variables.scss
from line 9:9 of app/assets/stylesheets/application.scss
from line 1:9 of app/assets/stylesheets/admin.scss
>> outline: lighten($alert-warning-bg, 9%);
helper.scss
.highlight {
outline: lighten($alert-warning-bg, 9%);
}
$alert-warning-bg was removed on 4.1 and replaced with theme-color-level($color, $alert-bg-level) mixin (to make it DRY?). usage example:
theme-color-level('warning', $alert-bg-level)
or specifically on your case:
lighten(theme-color-level('warning', $alert-bg-level), 9%)

How to precompile assets and avoid "Error: file isn't precompiled" on specific pages?

When I push my code to Heroku I get the following message:
Precompiling assets failed, enabling runtime asset compilation
Runtime compilation can cause issues, so I added the following line to config/application.rb:
config.assets.initialize_on_precompile = false
(As suggested at Error pushing to heroku - aborting my rake assets:precompile and on Heroku Help )
This allows the precompilation to work. However, some of my pages include other javascript files. For example, I include a file from 'vendor/javascripts' within certain pages by putting a tag on the specific page:
<%= javascript_include_tag "src/ace.js" %>
When I visit such a page, it causes the following error (when precompiling works):
ActionView::Template::Error: src/ace.js isn't precompiled
How can I fix it so such pages do not throw errors?
You'll need to add the file to the assets.precompile.
Add the following to your config/environments/production.rb to compile all your css/js files:
config.assets.precompile = ['*.js', '*.css']
You can add your ace.js and other required files in a javascript file for instance "custom.js"
Then you can use your regular code to include the file
Add the following in custom.js. ( Assumed ace.js resides in vendor/javascripts)
//= require ace
Add the file to compilation list by adding following in application.rb
config.assets.precompile += %w( custom.js )
You can now use your javascript_tag to include the source
<%= javascript_include_tag "custom" %>

Error compiling CSS asset (Compass + Sass + Heroku)

I have a site running on Heroku using Compass with Saas an is working fine (compiling assets when pushing to Heroku seems to be fine).
I added a new folder inside assets to namespace other styling, like this
/app/assets/stylesheets/site/site1.css
/app/assets/stylesheets/site/site2.css
/app/assets/stylesheets/site/common/base.css.saas
/app/assets/stylesheets/site/site/site1.css.saas
/app/assets/stylesheets/site/site/site2.css.saas
...
The problem is when I visit a page that use site1.css styling I get the following error
Error compiling CSS asset
Sass::SyntaxError: File to import not found or unreadable: ../compass/css3/text-shadow.
Load path: /app
(in /app/app/assets/stylesheets/site/common/base.css.sass)
/app/app/assets/stylesheets/site/common/base.css.sass)
The line that the error refers is this
/app/assets/stylesheets/site/common/base.css.sass
#import "../compass/css3/text-shadow"
I tried both "../compass/css3/text-shadow" and "compass/css3/text-shadow". In both cases I got the same error.
Any idea how to solve this?
Solved.
I needed to specify on production.rb file the additional files to compile
config.assets.precompile +=
Dir["#{Rails.root}/app/assets/stylesheets/site/site/*.*"].collect {|s| "site/" + File.basename(s).gsub(/.scss|.sass/, '') }
Now is working fine.

Rails 3.1 rake test:profile deprecation warning and empty output files

When runnign rake test:profile I get:
DEPRECATION WARNING: read_csv_fixture_files is deprecated and will be
removed from Rails 3.2. (called from block in autorun at
/Users/hade/.rvm/rubies/ruby-1.9.2-p290-perf/lib/ruby/1.9.1/minitest/unit.rb:508)
Unit.rb around line 508:
def self.autorun
at_exit {
next if $! # don't run if there was an exception
# the order here is important. The at_exit handler must be
# installed before anyone else gets a chance to install their
# own, that way we can be assured that our exit will be last
# to run (at_exit stacks).
exit_code = nil
at_exit { exit false if exit_code && exit_code != 0 }
exit_code = MiniTest::Unit.new.run(ARGV) <------ LINE 508
} unless ##installed_at_exit
##installed_at_exit = true
end
Is MiniTest calling this read_csv_fixture_files method? Is this normal behaviour with my setup? How can I remove this?
My environment:
Rails 3.1.0
Ruby 1.9.2-p290 with GC-patch
My tests seem to run ok, but my output files are useless. In my output files I only have this line:
ActiveSupport::Testing::Performance::Profiler#run
But when I run rails profiler 'User.all' I get nice console output and output files with some content.
Any help would be really appreciated. I have tried different Ruby versions with GC-patch, but no help there.

Resources