oddbird / susy

Pre-grid responsive layout toolkit for Sass, now deprecated
http://oddbird.net/susy/
BSD 3-Clause "New" or "Revised" License
3.87k stars 348 forks source link

context-slice of `X` can not be determined based on grid-columns #656

Closed bserem closed 7 years ago

bserem commented 7 years ago

I took some time to check Susy3 today. On a debian system with Sassc, Susy3.0.1 from npm I am getting some unexpected behavior.

While this works:

$susy: (
  columns: 20px susy-repeat(3, 10px) 20px,
);

html {
  width: susy-span(5 of 5);
}

As does this:

$susy: (
  columns: 1 susy-repeat(3) 1,
);

html {
  width: susy-span(5 of 5);
}

None of these work: columns: 20px susy-repeat(3, 100px) 20px, (example from: http://oddbird.net/susy/docs/a-config.html)

Error:

Error: [susy-normalize-columns] context-slice of `5` can not be determined based on grid-columns `20px 100px 100px 100px 20px`.

columns: 10px susy-repeat(3) 10px,

Error:

Error: [susy-normalize-columns] context-slice of `5` can not be determined based on grid-columns `10px 1 1 1 10px`.

Environment details:

$ sassc -v
sassc: 3.4.2
libsass: 3.4.3
sass2scss: 1.1.0
sass: 3.4
mirisuzanne commented 7 years ago

This is (mostly) the documented behavior (see the last paragraph of the shorthand section). Susy can slice a symmetrical grid (all columns are the same size) without knowing what part of the grid you need. For asymmetrical grids, you have to do the slicing explicitly with the susy-slice function.

You report a successful attempt with an asymmetrical grid (your first example). That would not be proper behaviour, but I can't reproduce your results. I get the same error on the first example that I do on the last ones.

bserem commented 7 years ago

I will need to dive into documentation further then.

What is strange is that this works: columns: 10px susy-repeat(3, 10px) 10px, but those don't: columns: 20px susy-repeat(3, 10px) 20px, columns: 10px susy-repeat(3, 100px) 10px,

mirisuzanne commented 7 years ago

That's not so strange.

It doesn't matter if you use susy-repeat, what matters is the end result. If the columns are all the same size, Susy can slice it without worrying about which slice. If the columns are different sizes, Susy needs to know which columns specifically you want to use.

bserem commented 7 years ago

Got it, shall we close the issue?