Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Including a file twice changes the output #411

Closed
chriseppstein opened this Issue · 2 comments

4 participants

@chriseppstein

Originally reported against compass by @StanAngeloff

Compass/compass#869

@StanAngeloff

D'oh, d'oh, d'oh, should have stopped to think for a mo' before I reported it. Here is the original report:


The following code listing produces unexpected output:

# config.rb

css_dir    = ''
sass_dir   = ''
images_dir = ''
relative_assets = true
line_comments   = false
environment     = :development
output_style    = :nested
// _forms.scss

form {
  input,
  select {
    color: white;
  }
}
// style.scss

@import "forms";
@import "forms";

When compass compile --force is used in the terminal, the following file is generated:

/* style.css */

form input,
form select {
  color: white; }

form input, form select {
  color: white; }

This comes up when a file is included from multiple sources as well. I've noticed it because when I use compass compile --force to re-compile all assets, some files end up with selectors on a single line. When I use compass watch those selectors are formatted properly on separate lines. This is likely because watch compiles only affected files, thus includes from multiple sources do no occur. compile --force on the other hand does all files.

The behaviour is inconsistent and very inconvenient as it generated constants changes in files.

I haven't been able to trace it in code.

@jackie

I'm having a similar problem with formatting changing, however the difference on our side is that there are no files being imported more than once per file.

I have a partial called _placeholders.scss which is imported in app.scss, checkout.scss, faq.scss, login.scss and signup.scss.

// _placeholders.scss

.fancy-placeholders {

  .form-item-text,
  .form-item-password {

    position: relative;

    .form-label {
      position: absolute;
      left: 12px;
      top: 7px;
    }

  }

}

With compass watching for changes, if I save _placeholders.scss, the files compile in the order listed above where app.css has the correct output:

/* app.css */

.fancy-placeholders .form-item-text,
.fancy-placeholders .form-item-password {
  position: relative;
}
.fancy-placeholders .form-item-text .form-label,
.fancy-placeholders .form-item-password .form-label {
  position: absolute;
  left: 12px;
  top: 7px;
}

But the rest of the files (checkout.css, faq.css, login.css and signup.css) have the wrong output with selectors on one line:

/* checkout.css */

.fancy-placeholders .form-item-text, .fancy-placeholders .form-item-password {
  position: relative;
}
.fancy-placeholders .form-item-text .form-label, .fancy-placeholders .form-item-password .form-label {
  position: absolute;
  left: 12px;
  top: 7px;
}

It's probably worth noting that if I were to go into any one of the files importing _placeholders.scss and saved, the selectors would be correctly compiled onto multiple lines. It seems like only the first file to get compiled gets the correct formatting.

Also, this only happens in a compass watch. I tried to recreate the issue using sass watch and they always, no matter what, correctly compiled onto multiple lines.

We're using Compass 0.12.2, Sass 3.1.20, and Ruby 1.9.3p194 and 1.8.7 (tested on a few computers, Mac, Windows and Linux).

Here's our config.rb:

# config.rb

http_path = "/" # not in use
css_dir = "../css/"
sass_dir = ""
images_dir = "images" # not in use
javascripts_dir = "javascripts" # not in use
preferred_syntax = :scss
output_style = :expanded
line_comments = false
sass_options = {:unix_newlines => true}
@nex3 nex3 closed this in 644da82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.