SCSS not compiling, suggestions?

Hi all, I’ve been actively developing an application throughout the year. I have a small SCSS file compiling classes for my font awesome icon classes.

This has been working just fine up until this week. I just added a few icon names and realized that the asset pipeline is no longer compiling this. Restarting the rails server and restarting the browser doesn’t work.

I don’t see any errors anywhere and gem versions of sassc-rails, sassc etc have not changed…

Any suggestions?

$fa5-icons: (
  'regular': (
    'sticky-note',
    'circle',
    'question-circle',
    'arrow-alt-circle-down',
    'file', 'file-alt', 'file-image', 'file-audio', 'file-video', 'file-pdf',
    'trash-alt',
    'check-circle',
    'clock'
  ),
  'solid': (
    'seedling',
    'sign-in-alt',
    'sign-out-alt',
    'link',
    'external-link-alt',
    'book',
    'poll',
    'tags',
    'edit',
    'plus',
    'grip-lines',
    'grip-horizontal',
    'play', 'pause',
    'video', 'volume-down',
    'user-circle', 'user-plus',
    'cloud', 'sun', 'umbrella',
    'users', 'users-cog',
    'map-signs', 'cloud-showers-heavy',
    'border-all', 'th-large',
    'exclamation-circle', 'check-circle'
  )
);

@each $style, $names in $fa5-icons {
  @each $name in $names {
    .fa5-#{$style}-#{$name} {
      $asset_url: image-url('fa5/#{$style}/#{$name}.svg');
      mask: $asset_url no-repeat center;
      -webkit-mask: $asset_url no-repeat center;
      display: inline-block;
    }
  }
}

I don’t have any suggestions for the code itself, I’m rusty with sass functions (and even more rusty with Sprockets and Sassc), but have you tried to just precompile your assets as you would on a deploy, i.e. RAILS_ENV=production bin/rails assets:precompile? If it compiles, you can at least rule out a couple of things.

1 Like

Hi there and thank you for your suggestion.

Simply running rails assets:precompile updated my assets in development and got my css updated. Thank you!

That said, this compilation previously happened automatically. What might have broken? :thinking:

1 Like

No idea! :grinning: I didn’t actually think this would work, I suggested it to rule out scss syntax errors in your code. So I can’t help you with pinpointing the source of the error itself. If you can reliably trigger it again, you could submit an issue to the Sprockets project on Github.

I seem to remember also encountering this situation where some SCSS syntax errors led to rendering persistently failing, even after fixing the syntax. I didn’t think of running assets:precompile and instead, IIRC I deleted all temporary files to recover the situation.