k0kubun / hamlit

High Performance Haml Implementation
https://rubygems.org/gems/hamlit
Other
980 stars 60 forks source link

Using the scss filter fails on @import #130

Closed hoenth closed 5 years ago

hoenth commented 5 years ago

We have a bit of scss embedded on a page with an @import statement

:scss
  @import bootstrap4/variables

Unfortunately, it can't locate the file: File to import not found or unreadable: bootstrap4/variables.

This works with haml (we are trying to switch to hamlit).

Do the files need to be further prepended with path information for hamlit to find them? The file above is in the app/assets/stylesheets/bootstrap4 folder

WaKeMaTTa commented 5 years ago

Add the path in Sass class

config/initializers/sass_settings.rb

# frozen_string_literal: true
Sass.load_paths << Rails.root.join('app', 'assets', 'stylesheets').to_s
hoenth commented 5 years ago

@WaKeMaTTa That did the trick. Thank you!. I also had to add:

Sass.load_paths << Rails.root.join('vendor', 'assets', 'stylesheets').to_s

k0kubun commented 5 years ago

Thanks WaKeMaTTa to help!


I guess rails-specific sass integration is missing in Hamlit, and I would like to eliminate the necessity to modify Sass.load_paths as long as it's Haml's feature. But actually rendering the following template

:scss
  @import test

failed with haml.gem in my rails new-ed app with app/assets/stylesheets/test.scss. I don't know how it could be working now. Is it possible to give me a small repository that reproduces the issue? (You can ignore my comment if you're happy with modifying Sass.load_paths)