Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Compass filter mixin?

I'm trying to use filter mixin this way in SCSS:

a {
  @include filter(grayscale(100%));
}

But when I compile, I got this error:

Undefined mixin 'filter'.

I'm using the latest version of this Gem with Rails framework.

http://compass-style.org/reference/compass/css3/filter/

like image 715
Caio Tarifa Avatar asked Apr 07 '13 21:04

Caio Tarifa


3 Answers

SASS Example

@import 'compass/css3/filter'

.filtered
  @include filter(grayscale(50%))
  @include filter(blur(2px))
like image 164
Logan Koester Avatar answered Nov 20 '22 17:11

Logan Koester


You need to import compass filter first.

To use multiple filters put all inside filter() without commas

@import 'compass/css3/filter'

// multiple calls like this:
.filtered {
    @include filter(blur(4px) brightness(1.3) saturate(1.5));
}
like image 23
brunnolou Avatar answered Nov 20 '22 18:11

brunnolou


According to Compass documentation this file can be imported using: @import "compass/css3/filter" at the top of sass file.

And then in sass file you can use it as

filter($filter-1, $filter-2, $filter-3, $filter-4, $filter-5, $filter-6, $filter-7, $filter-8, $filter-9, $filter-10)
like image 1
Aleksei Anatskii Avatar answered Nov 20 '22 17:11

Aleksei Anatskii