The "compact" function in Bourbon with SASS is not called

I have a problem using mixins included in Bourbon. When this mixin uses the "compact" Bourbon function, it simply compiles it in css without using it. Here is a screenshot of the generated CSS for the shadow box:

http://i.stack.imgur.com/YF1JB.png

I use it on a non-stationary site with the latest version of Sass. I use Codekit to compile.

Thanks for the help!

+6
source share
1 answer

Good, so after diving a little deeper, here's how I fixed it.

This problem is probably caused due to this commit: https://github.com/thoughtbot/bourbon/commit/ac07c990c0d0fe16f4c455490c9a9fdff7fe27af

The compact function has been rewritten in Ruby for better integration with Rails. At first I just copied the "stylesheet" folder from the repo. And this is when I started the fake sytax.

I fixed the error by reading the instructions :) - the installation instructions in Rails, and then it worked.

In your case idk, if they have a code implementation, but I believe that you can fix this by adding the following code:

@function compact($var-1, $var-2: false, $var-3: false, $var-4: false, $var-5: false, $var-6: false, $var-7: false, $var-8: false, $var-9: false, $var-10: false) { $full: $var-1; $vars: $var-2, $var-3, $var-4, $var-5, $var-6, $var-7, $var-8, $var-9, $var-10; @each $var in $vars { @if $var { $full: $full, $var; } } @return $full; } 

(I got the code from the repo)

in the _function.scss file name inside your add-ons folder and link to it in _bourbon.scss. And that should solve your problem.

+14
source

Source: https://habr.com/ru/post/905057/


All Articles