Asked  7 Months ago    Answers:  5   Viewed   108 times

Getting an error message when compiling my SCSS using the ruby compass gem.

run: /var/lib/gems/1.8/gems/compass-0.12.2/bin/compass compile
out: unchanged sass/partial/grid.scss
out:     error sass/partial/catalog.scss (Line 5: Undefined variable: "$paragraphFont".)
out:    create css/generated/partial/catalog.css 
out:    create css/generated/partial/base.css 
out: overwrite css/generated/screen.css

My screen.scss imports partials like this:

@import "partial/base";
@import "partial/catalog";

In my base partial I have the $paragraphFont defined.

$paragraphFont: 'Lucida Sans', arial;
$regularFontSize: 14px;

And in catalog.scss I use it:

.product-view #price-block {
    p {
        font-weight: normal;
        font-family: $paragraphFont;
        ....
    }
}

Weird thing is that the css gets compiled just fine, and the $paragraphFont is populated correctly. So I don't know why the compiler is complaining at me about an error.

 Answers

82

You're generating files that don't need to be generated.

  • screen.scss -> screen.css
  • base.scss -> base.css
  • catalog.scss -> catalog.css

The catalog file is being compiled on its own. Since it is not importing base.scss, the variables are not set. Your screen.scss file generates as you expect because it is importing all of the necessary information.

What you want to do is rename your partials to begin with an underscore to prevent them from being compiled on their own:

  • screen.scss -> screen.css
  • _base.scss (not compiled)
  • _catalog.scss (not compiled)
Tuesday, June 1, 2021
 
Niels
answered 7 Months ago
24

Define the variable: $return = array(); Problem solved.

But I really hope you're not creating a new database connection every single time you want to select data, and never closing any of those connections...

Friday, May 28, 2021
 
Optimus
answered 7 Months ago
55

Try it like this

margin: 0 (-$pad) 20px (-$pad);
Sunday, June 13, 2021
 
Grzegorz
answered 6 Months ago
53

I'm in the same boat (beginner to Sass/Compass) and had to do something similar. Here's what I came up with, using nested lists:

$flash_types: (success #d4ffd4) (error #ffd5d1);

@each $flash_def in $flash_types {
    $type: nth($flash_def, 1);
    $colour: nth($flash_def, 2);

    &.#{$type} {
        background-color: $colour;
        background-image: url(../images/#{$type}.png);
    }
}

It's not the most elegant solution but it should work if you can't find anything else. Hope it helps! I'd appreciate a better method too :)

Thursday, June 17, 2021
 
Keat
answered 6 Months ago
24

In order to refer to an instance variable within any object other than self, including super, you must use the structure pointer operator (->). The default scope of an instance variable is protected, which means it can only be accessed within the class it is defined in or a subclass of that class. Since CustomViewController is a subclass of BaseViewController, this scope is sufficient to access the variable using self->_vwHeader, but if the second class you were trying to do this from is not a subclass you will also need to change the scope to either @public or @package.

In summary, change your method call to:

[self->_vwHeader setHidden:NO];

and it should work for any subclasses of the base view controller.

Wednesday, August 11, 2021
 
DaveRandom
answered 4 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :  
Share