I am trying to test out less.js on a new project. I am 100% sure the javascript file is loading fine but I keep getting this error on the less file that is in my css folder. I am going to compile it using the less.app before I launch but I would rather just let less.js do it during development. Is there a problem with it not letting the browser access the file since it is .less or something else? Thanks (running ubuntu 11.04 and ruby v1.9.2, same error in firefox and chrome)
Here is my head.haml file where I link to less.js & app.less (which are both in the correct folders)
%link{:rel => "stylesheet/less", :type=>"text/css", :href => "/assets/css/app.less"}
%script{:src => "/assets/js/less-1.1.3.min.js", :type => "text/javascript"}
Here is the error I get in the browser when I open up app.less
LoadError at /assets/css/app.less
no such file to load -- less (in /home/blake/biddrr/assets/css/app.less)
Ruby /home/blake/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb: in require, line 239
Web GET localhost/assets/css/app.less
I had the same problem and I did some digging. The
no such file to load -- file
error means that Rails can't find the file, in our caseless
, in the system.This can be easily solved by going in the
Gemfile
and addingAfter that run a
bundle install
to get the less gem.Finally restart your rails server
rails s
I am kinda new to RoR and Ruby so may be some of the things I've done are useless or there are smarter solutions. Anyway this solved my problem :) I hope will work for you too!
Just put
gem 'less'
into assets section in your gemfile. And restart your server.Look on your web server terminal. I'm using WEBrick and got "ActionView::Template::Error (no such file to load -- less" after going through this http://railscasts.com/episodes/328-twitter-bootstrap-basics?view=asciicast screencast. All I did to fix it was reset the web-server.
You may need to assign a .less mime type on your web server to ensure it knows what to do with this file.