I am writing a sinatra app with haml and sass. When I try to link in the stylesheet with a scss extension located in my views folder I get the following error: NoMethodError at /nav.css undefined method `scss'
Here is my get method
get '/nav.css' do
content_type 'text/css', :charset => 'utf-8'
scss :nav
end
I have only gotten this to work when I switch to the older sass syntax. I also have to change the nav.scss to nav.sass and the get method to sass :nav
I have also tried just having sass :nav with nav.scss and sass :nav with nav.sass but still scss syntax
SASS is used when we need an original syntax, code syntax is not required for SCSS. SASS follows strict indentation, SCSS has no strict indentation. SASS has a loose syntax with white space and no semicolons, the SCSS resembles more to CSS style and use of semicolons and braces are mandatory.
Add the following to the <head> tag of your HTML file. The extension we installed will compile the SASS file index. scss into CSS and store the compiled code in a new CSS file, also called index. css .
The term SCSS is an acronym for Sassy Cascading Style Sheets. It is basically a more advanced and evolved variant of the CSS language. Natalie Weizenbaum and Chris Eppstein created it, and Hampton Catlin designed it. It comes with more advanced features- thus often called Sassy CSS.
I don't use the above code from the README, just put the following in your app.rb file after updating your gem.
get '/stylesheets/:name.css' do
content_type 'text/css', :charset => 'utf-8'
scss(:"stylesheets/#{params[:name]}")
end
Restart your server and you're all set. Happy Scssing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With