Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rake assets:precompile fails on production #158

Closed
charleskirk opened this issue May 10, 2013 · 8 comments
Closed

rake assets:precompile fails on production #158

charleskirk opened this issue May 10, 2013 · 8 comments

Comments

@charleskirk
Copy link

We've been struggling with this one for almost a day.

We're using a theme from wrap bootstrap, which uses SCSS. It compiles absolutely fine on development, but on production it just doesn't play ball.

I'm really lost on where to get help on this one from, any assistance would be greatly appreciated.

Here's some of my code: https://gist.github.com/charleskirk/5555615

  • let me know if anything else is needed.

Here's the error and stack trace:

localhost:assets charleskirk$ /Users/charleskirk/.rvm/rubies/ruby-1.9.3-p286/bin/ruby /Users/charleskirk/.rvm/gems/ruby-1.9.3-p286/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
(in /Users/charleskirk/jvo-portal)
rake aborted!
Invalid CSS after "&.": expected class name, was "#000"
  (in /Users/charleskirk/jvo-portal/app/assets/stylesheets/action_nav.css.scss)
/Users/charleskirk/jvo-portal/app/assets/stylesheets/action_nav.css.scss:104
/Users/charleskirk/.rvm/gems/ruby-1.9.3-p286/gems/sass-3.2.8/lib/sass/scss/parser.rb:1148:in `expected'
/Users/charleskirk/.rvm/gems/ruby-1.9.3-p286/gems/sass-3.2.8/lib/sass/scss/parser.rb:1084:in `expected'
/Users/charleskirk/.rvm/gems/ruby-1.9.3-p286/gems/sass-3.2.8/lib/sass/scss/parser.rb:1066:in `expr!'
@keats76
Copy link

keats76 commented May 21, 2013

Any luck with this? I'm in the same boat.

@charleskirk
Copy link
Author

Unfortunately not, it seems like a really deeply set problem. We actually ended up changing our deployment process to compiling in a staging production environment and then pushing out the compiled code. It's a shame.

Please do update this if you see anything!!

On May 21, 2013, at 11:30 AM, Michael White notifications@github.com wrote:

Any luck with this? I'm in the same boat.


Reply to this email directly or view it on GitHub.

@keats76
Copy link

keats76 commented May 21, 2013

I removed the offending code block (see below) from the action_nav and the asset precompilation worked fine. There is no noticeable impact to the theme as of yet. This is not ideal, but it is what it is. I'll generate the css differently if it comes down to it. Thanks for the quick response!

@each $pair in $buttonColors {
      &.#{nth($pair, 1)} {
        @extend %action-color-button-common;
        a {
          @include action-color-button(nth($pair, 2));
        }
      }
    }

@charleskirk
Copy link
Author

Hmm. Strange.

If I remember correctly, I believe we had more syntax errors. It drove us mad as we knew it was valid SCSS etc. Let us know if you find the be all and end all.

Charles.

On May 21, 2013, at 1:27 PM, Michael White notifications@github.com wrote:

I removed the offending code block (see below) from the action_nav and the asset precompilation worked fine. There is no noticeable impact to the theme as of yet. This is not ideal, but it is what it is. I'll generate the css differently if it comes down to it. Thanks for the quick response!

@each $pair in $buttonColors {
&.#{nth($pair, 1)} {
@extend %action-color-button-common;
a {
@include action-color-button(nth($pair, 2));
}
}
}

Reply to this email directly or view it on GitHub.

@charleskirk
Copy link
Author

Whoops nope.

Here's the fix, add

config.assets.precompile << /(^[^_\/]|/[^_])[^\/]*$/

to your config/environments/production.rb

This will compile everything except for partials, and that is the problem.

Let me know if this works,

Charles.

On May 21, 2013, at 1:27 PM, Michael White notifications@github.com wrote:

I removed the offending code block (see below) from the action_nav and the asset precompilation worked fine. There is no noticeable impact to the theme as of yet. This is not ideal, but it is what it is. I'll generate the css differently if it comes down to it. Thanks for the quick response!

@each $pair in $buttonColors {
&.#{nth($pair, 1)} {
@extend %action-color-button-common;
a {
@include action-color-button(nth($pair, 2));
}
}
}

Reply to this email directly or view it on GitHub.

@nickveys
Copy link

nickveys commented Jun 5, 2013

I'm not sure if this is a Compass or SASS issue, or an issue at all, but here's the fix: https://gist.github.com/nickveys/5711125/revisions

The 'black' and a couple other colors in the variables file were being interpreted as variables and swapped for their values, hence the #000 value showing up. Weird that it's only during precompilation, but quoting them fixes it.

@nickveys
Copy link

nickveys commented Jun 5, 2013

Here's another poor sap running into it in another realm: http://stackoverflow.com/questions/12822485/compass-compiling-style-sheets-changes-black-to-000

Doesn't seem to be sass-rails related.

@bluedreamR
Copy link

bluedreamR commented Oct 6, 2017

I deployed rails project on Amazon EC2.
but I found below issue

Precompiling asset files
rake aborted!
Sass::SyntaxError: Undefined variable: "$body-background".

finally,
home/ec2-user/.rvm/gems/ruby-2.4.1/bin/bundle:22:in load'
/home/ec2-user/.rvm/gems/ruby-2.4.1/bin/bundle:22:in <main>' /home/ec2-user/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in eval'
/home/ec2-user/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `

'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
! ERROR: Deploy failed.
-----> Cleaning up build
Unlinking current
OK
Connection to (server_ip_address) closed.

! Run Error`

help me!
I can't deploy my new version of this project on production because this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants