Search code examples
csstwitter-bootstrapgruntjslessgrunt-contrib-less

Less complaining about @brand-success is undefined, even though it is in variables.less


When trying to compile less, I am getting a missing NameError: variable @brand-success is undefined in app/static/css/less/style.less on line 131, column 15:. However, it is app/bower_components/bootstrap/less/variables.less which is imported by 'app/bower_components/bootstrap/less/bootstrap.less'.

When using grunt-contrib-less and compiling, it is showing:

Running "less:files" (less) task
File app/static/css/icons.css created: 0 B â 175 B
File app/static/css/main.css created: 0 B â 152.44 kB
File app/static/css/modal-large.css created: 0 B â 1.29 kB
>> NameError: variable @brand-success is undefined in app/static/css/less/style.less on line 131, column 15:
>> 130     .circle-green {
>> 131       .circle(@brand-success);
>> 132     }
Warning: Error compiling app/static/css/less/style.less Use --force to continue.

I verified it is pulling 'app/bower_components/bootstrap/less/bootstrap.less' because I have:

one@node ~/github/lbs/lbs/app/static/css/less $ cat vendor.less 
@import 'app/bower_components/bootstrap/less/bootstrap.less';
@import 'app/bower_components/font-awesome/less/font-awesome.less';
one@node ~/github/lbs/lbs/app/static/css/less $ 

And if I change the path on purpose to be wrong it will complain. So, I know it is picking up bootstrap.less.

Anyone know what is causing this?

Here is some more info:

one@node ~/github/lbs/lbs/app/static/css/less $ cat main.less 
// Main less file for your application.
// Use `@import` to use other less files
// relative to 'app/css' or 'vendor/css'.
@import 'vendor';
@import 'modal-large';
@import 'icons';
@import 'style'

one@node ~/github/lbs/lbs $ !grep
grep -il brand-success -R *
app/bower_components/bootstrap/dist/css/bootstrap.css.map
app/bower_components/bootstrap/less/variables.less
app/static/css/less/style.less
one@node ~/github/lbs/lbs $ 

Solution

  • I placed @import 'app/bower_components/bootstrap/less/bootstrap'; in style.less which fixed it. But this is really a hack...something else is wrong and if anyone can figure out why, that would be great.