How to get an access to SASS variables in Slim, HAML etc.?

How to get an access to SASS variables & mixins which are stored in the assets directory of project directly from HTML-preprocessors (Slim, HAML)?

I mean how to make work things like this:

// Ruby Slim
        @import 'lib/vars'
            background: $color


<style type="text/css">
    body {
        background: #fff

whereas $color is defined somewhere in lib/_vars.sass and equals to #fff.

Why do I need it? Well, I need it for page-specific styles and elements and I do not want to store them in global styles.

It doesn't work for me in Middleman+Slim+SASS+Compass environment. Ruby just says:

Error: File to import not found or unreadable: lib/vars.


I wish there was a better answer but, unfortunately, this is not possible.

This is possible with Sass 3. Review this article, which will have you:

  1. Use the sass_paths gem to manipulate the ENV var that holds the lookup paths
  2. Add an initializer that appends your path to the ENV var

For example:

# config/initializers/sass_paths.rb
require 'sass_paths'

# append a directory, or list of directories to SASS_PATH

Need Your Help

how to add two query results as a single result in sql?

sql sql-server database

I need to add two queries output as single result.

Reading In A String and comparing it C

c string

Im trying to create a C based string menu where a user inputs a command and then a block of code runs.