grunt-sass (with bower compass package) throwing error on compile - sass

I am trying out grunt-sass (instead of grunt-contrib-watch) to use the super speedy libsass compiler.
I've managed to get it working with compass by using a compass bower package. (https://github.com/Igosuki/compass-mixins) So the compass mixins are available. However I am getting the following error
error: only variable declarations and control directives are allowed inside functions
The error is pointing to an #if statement in one of my function calls (i've tried removing that function but it just then fails at the next #if statement).
If I omit my functions file I then get another error, pointing to one of my mixins
error: expected '{' in media query Use --force to continue.
Does anyone have any idea what's going on?
All of this stuff was working when using grunt-contrib-watch.
Thanks

With no actual sass file to look at I assume that you are using features that aren't implemented in libsass yet. To quote from the offical node-sass repo (on which grunt-sass) is based on:
The libsass library is not currently at feature parity with the 3.2
Ruby Gem that most Sass users will use, and has little-to-no support
for 3.3 syntax. While we try our best to maintain feature parity with
libsass, we can not enable features that have not been implemented in
libsass yet.

Related

How to use SassC on OSX

I have used sass before and it's great. But Slow. And ruby Sass is being dropped.
I'd like to swtich to a wrapper around libsass. I think that is the accepted upgrade path.
How do I do this? I've tried installing SassC via homebrew, but it doesn't seem to work the same way.
eg
sassc --watch scss:css --style compressed
fails with error, unrecognized option `--watch'
What do I need to do to get sass compilation working in the terminal using libsass?
There was a discussion in the issue section of this project. It is not implemented and nobody was working on it according to this thread. But several workarounds were posted (e.g. using fswatch or node-sass). One suggestion was to use gosass which looks quite young but supports your -watch option.
Maybe this is something for you. If not you will find probably a lot of wrappers for libsass out there.

Can you download the compass/css3 file?

I can't get ruby running and i dont want to go through all the hurdles of fighting with my osx version of ruby.
I downloaded dart sass which has no support for compass since it's deprecated. I'm trying to get my old sass code to work while I work on replace all my mixin that I used that rely on compass.
Is there a way I can download the compass/css3 mixin stylesheet?
I found their site http://compass-style.org/reference/compass/css3/ other than going through each page and copying all the code. Is there no master code file that I can download all the mixins?
Thank you.

Grunt-sass can't compile sass maps?

I want to use this MQ Mixin, but I'm getting an error when trying to compile this mixin:
Warning: C:/xxxxx/mq:13: error: error reading values after mobile
I'm using Grunt with grunt-sass plugin to compile my sass. My first thought was that I am using the old version of grunt-sass that does not support sass maps, and I was partially right because I was using the older version. Quick update to the latest version (at the moment - 0.14.0) and nothing, still getting same error. Also I checked if the error occurs with ruby-sass (v.3.3.14) but does't, file compiles properly. So, what's going on with grunt-sass? What am I missing here? Thanks in advance.
As cimmanon mentioned, grunt-sass is using libsass, which is far behind on features. You should use grunt-contrib-sass instead, which compiles using Ruby sass. You will need Ruby and the sass gem installed for it to work.

Setting up compass/sass project

When I was young I experimented with CSS, and then after a while my peers pressured me into trying SASS. It's been a slippery slope and the pushers have now got me onto Compass.
I don't really understand the difference between the following two commands
sass --compass --watch .
compass watch .
As I was having problems with the first command, I tried setting up a Compass project and using the 2nd.
However, this dies saying "Undefined mixin 'background-image'". I can get that error to go away by adding an #import "compass"; at the top of my .scss file. But why would I have to import compass when I'm running the compass command itself?(!) Surely all the libraries are included there? Obviously not.
Any help gratefully received.
The --compass flag for the sass command is only intended to be a quick way to access the Compass library. If you actually need to configure Compass, then it is recommended that you setup a Compass project and use the compass command (see: https://github.com/nex3/sass/issues/858).
Compass is more than just a collection of mixins for prefixed properties. It is an extension manager that happens to have a few extensions by default (compass, blueprint, etc). Using Compass only grants you access to the helper functions (which are written in Ruby) by default. This is by design: you include only the items you need, not what Compass thinks you need.

getting error after ugrading to sass-3.1.8

after upgrading to sass-3.1.8 form sass-3.1.7 I get this error:
Functions may only be defined at the root of a document.
any Idea how I can solve this?
I'm using some of bourbon's mixins and it's imported at the top of my stylesheets, that's all.
I have the same problem and could not solve it by modifying code.
The way I solved was to use an older version:
gem uninstall sass
gem install sass -v 3.1.1
Ok Here is what I come up with:
SASS team decided to make a change (in this case "Functions may only be defined at the root of a document.") that made some plugins incompatible. in my case it was bourbon library. I made a ticket on github homepage of the bourbon and the owner updated the code and released a new version that's working with latest api.
I think this change should have got a bigger version bump to indicate the api change.
Sass developer here. Mixins and functions were never meant to be allowed in a scoped context. A bug was fixed recently that caused them to be caught when in an imported file (before this fix they were only caught if defined in the primary sass file).
That said, it's not a feature we're explicitly opposed to, but we'd would need to properly test it, document it, and support it as an official feature.

Resources