foundation / foundation-sites

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.
https://get.foundation
MIT License
29.66k stars 5.48k forks source link

foundation new project fails to compile correctly with compass 1.0.0 #5636

Closed rossbayer closed 10 years ago

rossbayer commented 10 years ago

If a user follows the steps outlined at http://foundation.zurb.com/docs/sass.html and then uses compass as opposed to libsass, the compile will succeed but the only content that will be included in the generated CSS file will be from foundation/components/_visibility.scss. This is with compass 1.0.0 and sass 3.4.0 (both the latest versions from rubygems.org).

After some investigation, the problem is with the exports mixin on line 11 of _functions.scss. First, the index function returns null, not false, so the comparison is invalid. Second, the !global keyword needs to be used with the append call in order for the $modules reference to be properly scoped. Here is what the mixin should look like for Compass 1/Sass 3.4:

$modules: () !default;
@mixin exports($name) {
  @if(not index($modules, $name)) {
    $modules: append($modules, $name) !global;
    @content;
  }
}

If desired, I can submit a pull request for this. I didn't just because I don't know how the above will affect compilation with libsass (could not find anywhere what version of Ruby Sass they are compatible with).

Steps to reproduce issue:

$ gem install foundation
$ foundation new testproject
$ gem install compass -v 1.0.0 
$ compass compile

After executing the above, look as stylesheets/app.css and observe that almost all content is missing from the generated file.

noeljackson commented 10 years ago

There is already a PR that was not merged, however, I notice the fix no longer breaks libsass per this: https://github.com/sass/libsass/pull/409

SalahAdDin commented 10 years ago

Very interesting!

mafrosis commented 10 years ago

I hit this one upgrading from Foundation 4 -> 5 today. Hacking in the changes from #5632 fixed my build.

jspradlin commented 10 years ago

If you follow the instructions above with compass 1.0.1, I did not see the errors, however most of foundation does not make it to the output app.css.

myinitialsaretk commented 10 years ago

@mafrosis Thanks, that fix worked.

mcmullengreg commented 10 years ago

I've tried working through a variety of fixes and haven't had any luck with getting compass to compile. The best I've gotten is type and visibility. Any ideas as to what happened, I just setup a new project less than a week ago and it worked great. Now I can't get a new project to work at all.

mafrosis commented 10 years ago

@mcmullengreg I suggest you check/upgrade your compass and sass versions, and then apply the manual hack from #5632 (which won't be needed when foundation is updated)

> compass -v
Compass 1.0.1 (Polaris)
Copyright (c) 2008-2014 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass
> sass -v
Sass 3.4.0 (Selective Steve)
mcmullengreg commented 10 years ago

I have those versions on my work MacBook but am still running 3.3.1 and 0.12.6 at home. Which is nice since those versions still work (for me) currently. I'll keep an eye out for the updates in the coming days (at work).

Thanks @mafrosis

michaelworm commented 10 years ago

Please implement this fix and push it to Foundation 5.3.4. We need this immediately so we don't have to patch everyone's Foundation Version for ourselves.

duffyjp commented 10 years ago

Foundation 5.4 didn't fix this for me.

duffyjp commented 10 years ago

UPDATE: Reverting from sass 3.4 to 3.2.19 eliminated the problem for me. Using Foundation 5.4 still.

createproblem commented 10 years ago

:+1:

Sureiya commented 10 years ago

The problem with this for me is that it was silently failing. I've been pulling my hair out for days trying to figure out what was causing it. Anyone know how to get things like this to not silently fail in the future?

noeljackson commented 10 years ago

I've found that this fix works and does not fail silently. https://github.com/zurb/foundation/pull/5651 It's just a slight bit different from what @rossbayer proposed.

rafibomb commented 10 years ago

An older version of Compass tested .12 worked fine today. Newer Compass versions are causing the issue. We are looking into why.

oblivious87 commented 10 years ago

What @rossbayer did in https://github.com/zurb/foundation/pull/5651 fixed the issue. Thanks @noeljackson for pointing that out.

philipandersson commented 10 years ago

@duffyjp What version of Compass are you using?

duffyjp commented 10 years ago

@Phillys 0.12.7

chillichicken commented 10 years ago

When I follow the instructions on http://foundation.zurb.com/docs/sass.html#nocli I get delivered an unstable and apparently untested version of the sass components. (Not mentioning the time I spent to find this..)

Why isn't the documentation website pointing to a stable release branch ?

I never have such issues with twitter bootstrap.

ghost commented 10 years ago

Thank you for the fix!

I curious why this did not throw an error while compiling?

tvollstaedt commented 10 years ago

I've been looking for this for days now. The simplest solution is to adjust compass/sass dependencies so foundation only pulls compatible API's. Please do this ASAP so we can continue using a clean codebase (patching libraries is a no-go).

@mjatharvest Because i'ts just an if-statement that returns a false instead of true.

BTW, this API-breaking change was introduced 7 months ago: https://github.com/sass/sass/commit/79bad1ff473cc06c66b85086403f4a1905938e37 This should really be a hotfix, not a milestone release.

gakimball commented 10 years ago

We merged in #5651 to get our codebase working with Sass 3.4 and Compass 1.0. We're also now compiling our docs with Ruby Sass instead of libsass, but the small changes we made to the codebase shouldn't break libsass compatibility.

Jezfx commented 10 years ago

Thank you for this fix!!

sebastiansulinski commented 10 years ago

You're a live saver - I've updated compass two days ago and already had to re-do one project - now I just had to amend one scss component for another project which was using Foundation 5.3.3 and same happend - the _functions.scss suggestion fixed it for me.

marketingpartnersau commented 10 years ago

AMAZING. This drove me nuts for several days.

thenikso commented 10 years ago

Why is this closed? I'm still having this issue with latest version of compass (or sass) and foundation. @rossbayer fix in the first post works for me too

gakimball commented 10 years ago

We had to roll back Sass 3.4 support temporarily to maintain support with Sass 3.2, required for Rails users, and libsass, which is used by an increasingly large number of folks. In a few weeks we're going to actually push forward the codebase whether sass-rails, still hardcoded to 3.2, has caught up or not.

This has been something of an ongoing saga; if you're interesting in reading a little bit about it, Bryan Jones, the creator of CodeKit, wrote a pretty great overview of the whole situation. We're trying to juggle compatibility with four versions of Sass (now five with libsass 3.0 out last week).