I have a Rails app getting the following error:
Less::ParseError in Home#index
Showing /Users/burtondav/sites/requestsys/app/views/layouts/application.html.erb where line #20 raised:
Cannot call method 'charAt' of undefined
(in /Users/burtondav/sites/requestsys/app/assets/stylesheets/bootstrap_and_overrides.css.less)
Extracted source (around line #20):
17: }
18: </style>
19:
20: <%= stylesheet_link_tag "application", :media => "all" %>
Some GEMS I'm using:
gem 'rails', '3.2.11'
gem 'twitter-bootstrap-rails'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'less-rails'
gem 'commonjs'
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
It seems to be a problem with LESS that Bootstrap uses.
I've read several other similar issues. So, I upgraded Ruby to 1.9.3p374. But, that didn't fix the problem.
Any ideas?
THANKS!
UPDATE
This is the bootstrap_and_overrides.css.less
@import "twitter/bootstrap/bootstrap";
@import "twitter/bootstrap/responsive";
// Set the correct sprite paths
@iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings");
@iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white");
I have temporary fixed the issue. There is a syntax change to the mixins.less that seems to only be supported by LESS.js
As an example:
Post-2.3 release:
.offsetX (@index) when (@index > 0) {
.offset@{index} { .offset(@index); }
.offset@{index}:first-child { .offsetFirstChild(@index); }
.offsetX(@index - 1);
}
Pre-2.3 release
.offsetX (@index) when (@index > 0) {
(~'.offset@{index}') { .offset(@index); }
(~'.offset@{index}:first-child') { .offsetFirstChild(@index); }
.offsetX(@index - 1);
}
After adding (~"") back in everywhere it was removed (you will have to view a diff from 2.3 and the release before to see where its been removed, all my assets compile again with no errors and still using LESS.
This change was only in mixins.less btw and only about a total of 5 or 6 lines.
Got the same failure. Fixed it by rolling back twitter-bootstrap-rails to version 2.1.4
(as of this writing the latest is 2.2.4
)
# Gemfile
...
group :assets do
...
gem "therubyracer"
gem "less-rails"
end
gem "twitter-bootstrap-rails", '2.1.4'
After following up with you in the comments. It seems the answer lies in opening a github issue with either twitter-bootstrap-rails or less-rails describing your issue. You could also follow on the original issue: https://github.com/seyhunak/twitter-bootstrap-rails/issues/72
Otherwise two solutions are offered to you:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With