Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass compile issue #5811

Closed
paullaz opened this issue Sep 16, 2014 · 21 comments
Closed

Sass compile issue #5811

paullaz opened this issue Sep 16, 2014 · 21 comments
Labels

Comments

@paullaz
Copy link

paullaz commented Sep 16, 2014

This bit in _functions.scss fails in 5.4.4.0 on Rails

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

The "!global" is new from 5.4.3.1, removing it allows Rails to work.

@deepflame
Copy link

error scss/app.scss (Line 13 of bower_components/foundation/scss/foundation/_functions.scss: Invalid CSS after "...odules, $name) ": expected "}", was "!global;")

same here.
I created a new project with the foundation command line tool and get the same error. Also updating compass did not solve it.

How is this supposed to work without removing this line?

version: 5.4.3 (from bower.json)

@deepflame
Copy link

deleting the stylesheets folder, running a compass compile fixed it for me

#5795

@gakimball
Copy link
Contributor

Your Rails project is likely compiling using an older version of Sass. See if you can get it to at least Sass 3.3 and then it should work properly. Or removing the !global flag like you did works also.

@DanielKehoe
Copy link

The error occurs when using sass-rails 4.0.3 which installs sass 3.2.19. That's the default for Rails 4.1.6, the most recent version of Rails. If Foundation v5.4.4.0 requires a newer version of Sass, you're out ahead of Rails and the gemspec should force the newer version of Sass.

@DanielKehoe
Copy link

@gakimball I'm the author of the book Learn Ruby on Rails and I use Foundation in the book to introduce Rails to beginners. It's important, especially for beginners that have no experience with gem versions and troubleshooting, that the experience of setting up a Rails application with Foundation should be trouble-free. Do you have a release process in place that tests compatibility with Rails by building a simple Rails application with the current version of Rails? This has happened before (foundation-rails 5.1.1.0 was incompatible with the Rails asset pipeline). I'd be happy to provide a simple Rails application that you could add to your testing regimen (you could use the rails-foundation example application). I don't know why we're seeing these release issues with foundation-rails, but I hope something can be done to avoid these glitches.

@christianvuerings
Copy link
Contributor

Same here, we're using 'sass-rails', '~> 4.0.3' and are hitting this error with foundation 5.4.4 and can't update because of this issue.

@paullaz
Copy link
Author

paullaz commented Sep 17, 2014

You can manually edit the _functions.scss of the installed gem, which in my case is located at /home/paul/.rvm/gems/ruby-2.1.2@propproj/gems/foundation-rails-5.4.4.0/vendor/assets/stylesheets and remove the !global flag in the above mentioned bit of code or maybe try the 'sass-rails' 5 beta which I haven't done. Otherwise Daniel's suggestion to set the rev level to 5.4.3.1 in your gemfile for now keep you running.

@christianvuerings
Copy link
Contributor

@paullaz Since we have an app that's used by multiple devs and is hosted as well, modifying files in gems aren't really an option. For now we need to stick to '5.4.3.1'.

Another thing we tried is to use 'sass' and compass as stand-alone gems, which seems to work but then we have another library rails_admin that relies on sass-rails.

@kayzee
Copy link

kayzee commented Sep 18, 2014

Very interested in this issue as well. I had to manually edit the _functions file to remove !global, but this isn't ideal because Heroku and other SaaS VPS won't allow this edit, which means we can't deploy!

@dasuchin
Copy link

Removing the !global also prevents the import once functionality from working, at least when using libsass. Switching to ruby sass fixes the issue. This should probably be fixed soon for those who use libsass.

bkuhlmann pushed a commit to bkuhlmann/auther that referenced this issue Sep 20, 2014
- There is a known issue with the latest Foundation Rails release that
  causes SASS compile issues in Rails apps due to requiring a newer
  version of SASS that Rails is currently incompatible with.
- See [Issue 5811](foundation/foundation-sites#5811) for
  details.
@scottalan
Copy link

I had to backup to "foundation": "5.4.3" and I'm using sass (3.4.5). That seemed to do the trick for now.

DanielKehoe added a commit to RailsApps/rails_apps_composer that referenced this issue Sep 24, 2014
DanielKehoe added a commit to RailsApps/rails-composer that referenced this issue Sep 24, 2014
@JamesChevalier
Copy link

It looks like 5.4.5.0 fixes this via this commit.

@dasuchin
Copy link

Has anyone tested it? When I removed that line it removed the functionality that prevented stylesheets from being compiled multiple times.

@gakimball
Copy link
Contributor

So we put out the new patch, which fixes things for Sass 3.2, 3.3, and libsass, but in the process we had to axe support for Sass 3.4. (This wasn't specified in the changelog that went out last night so I just added it.) The Sass will still compile in 3.4, but because of the changes in variable scope the import-once functionality breaks.

New projects created via foundation new include a Gemfile that specifies Sass 3.3 and Compass 1.0. In addition, if you try to compile with Sass 3.4 or greater, a warning will output to the console instructing you to use bundle exec to compile your stylesheets.

It's not an ideal solution, but it's all we can do after we told Sass 3.4 folks "yes you can upgrade". Now we have to tell them not to.

So if you're upgrading an existing project on our Compass stack, add a Gemfile to the root of your project with these lines:

source "https://rubygems.org"
gem "sass", "~> 3.3.0"
gem "compass", "~> 1.0.0"

Then run bundle to install the dependencies and bundle exec compass watch every time to want to compile. Once again, it's not ideal, but version difference hassles are why tools like Bundler exist.

@DavidBennettPIO
Copy link

Hi Guys,

Took me a while to get a Rails app up and running with sass > 3.3, compass 1.0.1 and foundation-rails that didn't have dependency hell, will compile without fatal errors and doesn't have this issue.

Here is what is in my gem file:

#gem 'sass-rails', '~> 4.0.3'
gem 'sass-rails', github: 'rails/sass-rails', branch: 'master'
gem 'sass', '~> 3.3.0'
#gem 'compass-rails'
gem 'compass-rails', '~> 2.0.1'
#gem 'compass-core', github: 'Compass/compass', branch: 'stable'
gem 'compass', '~> 1.0.1'

gem 'foundation-rails', '5.4.5.0'
gem 'foundation-icons-sass-rails', '~> 3.0'

gem 'sprockets', '~> 2.12.0'

Hope that helps other people trying to get it all working in rails.

@dylanpyle
Copy link

Looking forward to a proper fix for this - having such a breaking change in a patch version really threw things off.

Here's some more context for anyone else who might have stumbled across this rabbit hole: bdkjones/CodeKit2#443 (comment)

@unfulvio
Copy link

Hi,

just updated Foundation to 5.5 with bower and now can't compile anymore with grunt/sass - I was using SASS 3.2, tried to update to 3.3.9 or 3.4x but to no avail. On 3.3.9 I get several deprecation warnings. On all versions I get a syntax error concerning usage of incompatible units 'rem' and 'px' found in line 247 of _top-bar.scss (probably others too, grunt exited), and an error in !global used in modules in _functions.scss exports - was expecting '}'

seems like dependency hell is back... what version of sass one should use to compile Foundation? what else should I have in check?

@DavidBennettPIO
Copy link

I havent tested yet 5.5 (still to fresh even for me) but the changelog suggests it should work with sass 3.3 and 3.4. Might want to open this as a new issue so core devs can help out? (doesnt look like the exact same issue as the one we had here)

@unfulvio
Copy link

well one of the issues was the "!global" mentioned in OP, anyways will do another test once I figure out which specific 3.3.x or 3.4.x is best suitable

@DavidBennettPIO
Copy link

foundation-rails mentions sass 3.4.9 foundation/foundation-rails@af76360 for use with 5.5 ... but these commits are only 3 days old and I'm not sure if there complete yet. We would need a core dev to give some background to help navagate this dependency hell moving forward.

@rafibomb
Copy link
Member

This has been resolved here: #6148 (comment)

oleksandrbyk added a commit to oleksandrbyk/olek-rails-composer that referenced this issue Feb 6, 2019
jeffbyrnes added a commit to jeffbyrnes/leahandjeff.com that referenced this issue Feb 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests