开发者

Less.js LoadError - no such file to load -- less on main .less file

开发者 https://www.devze.com 2023-04-01 01:49 出处:网络
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 usi

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 case less, in the system.

This can be easily solved by going in the Gemfile and adding

group :assets do
  gem 'less'
end

After 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.


You may need to assign a .less mime type on your web server to ensure it knows what to do with this file.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号