Note that there are some explanatory texts on larger screens.

plurals
  1. PORails assets:precompile strange behavior
    primarykey
    data
    text
    <p>I found myself in front of a strange behavior of the <code>assets:precompile</code> task, or at least in front of something I don't fully understand.</p> <p>So, I am using Rails 3.1.3, Sprockets 2.0.3, Less 2.0.11 for my web application, plus I rely on Bootstrap for the layout, so I am using also less-rails 2.1.8 and less-rails-bootstrap 2.0.8. I have customized the style like they say <a href="https://github.com/metaskills/less-rails-bootstrap-test/blob/master/README.md">here</a>.</p> <p>The configuration of my assets is:</p> <pre><code>stylesheets |--application.css.scss |--custom-style/ |--variables.less |--mixins.less |--buttons.less |--custom-style.css.less </code></pre> <p>In application.css.scss I do</p> <pre><code>//=require custom-style </code></pre> <p>And in custom-style I do</p> <pre><code>@import "twitter/bootstrap/reset"; //@import "twitter/bootstrap/variables"; // Modify this for custom colors, font-sizes, etc @import "custom-style/variables"; //@import "twitter/bootstrap/mixins"; @import "custom-style/mixins"; // And all the other standar twitter/bootstrap imports... // Other custom-style files to import @import "custom-style/buttons" //... // And other rules here //... </code></pre> <p>Finally in <code>buttons.less</code> I use some variables and mixins defined in the <code>variables.less</code> and <code>mixins.less</code> Bootstrap files, <code>@white</code> and <code>.buttonBackground</code> to be more specifc.</p> <p>If I launch <code>bundle exec rake assets:precompile</code> with the above configuration, the task fails and I get this error:</p> <pre><code>$ bundle exec rake assets:precompile /usr/local/rvm/rubies/ruby-1.9.3-p0/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p0/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets rake aborted! .buttonBackground is undefined </code></pre> <p>But is that if I do this changes</p> <pre><code>buttons.less --&gt; buttons.css.less @import "buttons" --&gt; @import "buttons.css.less" </code></pre> <p>Everything works fine!!</p> <p>Is it something related to the scope of less variables and functions when working with nested imports? Or something that has to do with the order the less parser, or Sprockets, processes the import tree?</p> <p>Am I missing something or doing something in the wrong way?</p> <p>Thanks :)</p> <p><strong>Note:</strong> I get the error even with the original variables and mixins files, so it's not connected with the overrides done into them.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload