1

Following the instructions all works fine if the less is all in one file, however, using @import it loses all reference to variables.

I placed my .less files under /vendor/frameworks/

Added the following to application.rb

config.less.paths << "#{Rails.root}/vendor/frameworks"
config.less.compress = true

in /app/assets/stylesheets/application.css

... 
main.css.less
...

Content of main.css.less:

@import "variables";
@import "common";

variables.less & common.less are put into vendor/frameworks.

The files can be found and this all works fine. However, variables defined in variables.less are not accessible in common.less when i pre-compile in production, which renders it useless. I have 25 less files in my framework and I don't fancy putting them all into one file.

I added these in my gemfile:

gem 'therubyracer'
gem 'therubyrhino'
gem 'less-rails'

Should this functionality described above work, or is it meant to be all in one file ? Which I hope isn't the case. Thanks, G

EDIT: Forgot to add the error message when pre compiling:

RAILS_ENV=development rake assets:precompile
....
Less::ParseError: variable @base is undefined
  (in /Users/[myuser]/Development/RoR/myapp/vendor/assets/frameworks/common.less)
at /Users/[myuser]/.rvm/gems/ruby-2.0.0-p247/gems/less-2.5.0/lib/less/js/lib/less/parser.js:604:31
Georg Keferböck
  • 1,967
  • 26
  • 43
  • currently I am compiling less manually with node.js and place the css into the /assets/sylesheets folder. Slightly painful exercise - but at least it works. So if anyone knows better - pls let me know. – Georg Keferböck Apr 11 '14 at 04:46

0 Answers0