SASS error: can't import Compass - css

I've been using sass and compass on this computer for a few months with no issues.
Additionally, my config.rb and sass directories have always been set up the same way, and they're the same on all of my projects.
Recently, I started getting this error in Sublime when I build the sass: Sass::SyntaxError: File to import not found or unreadable: compass.
The first line of my .scss file is #import "compass";, so I see this error in Terminal: error sass/style.scss (Line 36 of _vertical_rhythm.scss: Incompatible units: 'px' and 'em'.)
I've been searching for days, and I see answers around some of this stuff (the vertical-rhythm specifically), but nothing is my exact problem, and I can't find a solution.
My compass version is 0.12.5 (Alnilam), and my sass version is 3.3.4 (Maptastic Maple).
At work, everything compiles fine with the exact same files, working from the exact same GitHub repo. I need to check my versions of compass and sass at work tomorrow, but in the meantime, I'm stumped.
Any ideas? Has this happened to anyone?

After a month of troubleshooting, the solution ended up being simpler than expected.
I uninstalled all versions of both Sass and Compass, and then I installed the latest Compass and let it install Sass automatically.
So after doing sudo gem uninstall compass and sudo gem uninstall sass, I did sudo gem install compass. That installed both Compass and its dependencies (Sass version 3.2.19). (I'm on a Mac, so I had to use sudo.)
Solved!

if this is on mac:
Go to:
/var/folders/p_/w19t0k956zz_bg0bgs0cn6200000gn/T/liferay
and delete following folders:
document_preview document_thumbnail ruby

Related

How to address node-sass regression(?) "It's not clear which file to import for #import"

It seems that a recent version of node-sass (3.4.1) breaks our build. I am consistently getting this error message:
It's not clear which file to import for '#import "../file"'.
Candidates:
../file.scss
../file.css
Please delete or rename all but one of these files.
Now, this is occuring for all the files in the project that have not explicitly specified "file.scss" in their name.
I have not been able to determine a fix for this bug - Nor can I find any documentation to address what has changed in node-sass to cause it. We have too many files for it to be practical to go rename each import.
Can someone point me in the right direction?
Edit:
This is also happening with files which have an underscore (eg. _file) in their path. Doesn't seem to recognize that these files are partials.
I had the same problem, but only with node-sass version 3.4.2. Version 3.4.1 was working ok for me.
It seems this is a known issue in node-sass - https://github.com/sass/node-sass/issues/1222 however its not clear exactly which versions are affected.
I fixed it by uninstalling grunt-sass, then installing the exact version of node-sass that worked correctly (v3.4.1), and then finally reinstalling grunt-sass.
$ npm uninstall grunt-sass
$ npm install node-sass#3.4.1 --save-dev
$ npm install grunt-sass
This means grunt-sass uses your installed version, rather than installing its own version which it defines as "node-sass": "^3.4.0"
Weirdly even though I specified an exact version in the install command I still ended up with this in my package.json:
"node-sass": "^3.4.1"
So I manually changed that to the exact version so other developers in the team would get the correct version:
"node-sass": "3.4.1"
Of course if you find that the only version that works for you is v3.3.0 then use that that version in the instructions above.
Option 1
You can import using the file extension
#import "../file.scss"
Option 2
Or you can tell SASS not to generate the .css file by import without output. You have to rename the file from file.scss to _file.scss
That will let you import like this
#import "../file"
I prefer option 2 as it reduces the number of css files you have to keep track of.

compass cannot compile completely using compass v0.12.6+sass v3.3.1? [duplicate]

I have just upgraded to Sass 3.3 so that I can use some of the new features (BEM styled class names, mappings, #at-root, etc). If I compile my project with Sass (via sass --watch), it works just fine. However, if I compile it using Compass (via compass watch), I get an error when using the new Sass features.
I'm using Compass 0.12.
Compass 0.12 explicitly depends on Sass 3.2. Even if you have a newer version of Sass installed, it will still compile with 3.2. In order to use Sass 3.3 or later, you have to be using Compass 1.0 or later.
Running the gem install command normally should get you the latest stable version.
gem install compass
At the time this question was asked, Compass 1.0 was still in beta. To install the latest beta version of a gem, you will need to install it using the --pre flag.
gem install compass --pre
Note that you do not need to install Sass first in order for this to work. Installing Compass will automatically install the latest version of Sass that it is compatible with.
I have Compass 1.0 installed and it still errors
Double check any other dependencies you might have (Compass extensions, etc.), one of them might be specifying an older version of Sass or Compass.
If you're using an application or build tool rather than using the commands directly, make sure they're not referencing older versions of Compass.
Windows users
As a Window user, I got an error when I tried to watch my project using the newer Compass.
LoadError on line ["36"] of C: cannot load such file -- wdm"
To fix that problem:
You must install the ruby DevKit:
Download found here: http://rubyinstaller.org/downloads/
Follow this page to properly install:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
Now install wdm:
gem install wdm
There didn't seem to be any one place that contained the whole list of steps required, in order, to make this work, so here they are. This list is for Windows, but it may work fine on other platforms.
Install Ruby -- use 1.9.3 -- http://rubyinstaller.org/downloads .
Download the Ruby DevKit found lower on the same page -- http://rubyinstaller.org/downloads/
run it to extract it somewhere (permanent). Then cd to it, run “ruby dk.rb init” and “ruby dk.rb install” to bind it to ruby installations in your path.
gem install wdm
gem install sass
gem install compass --pre
It now is, in the latest version of Compass. Update compass to get the changes and work with Sass 3.3 and higher
Current Sass compatibility can be found here: https://rubygems.org/gems/compass
To upgrade just run
$gem install compass

Grunt Compass/SCSS not compiling

I'm pretty new to whole Grunt and SCSS workflow stuff and recently configured Grunt with a WP theme development that run under MAMP. Installation of Node, NPM, Grunt and its dependencies went smooth. However, when i make a change on .SCSS files, it doesn't seem to be reflecting the changes to the .CSS files due to following warning from compass:
Running "compass:app" (compass) task
LoadError on line ["55"] of /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb: cannot load such file -- susy
Run with --trace to see the full backtrace
Warning: ↑ Use --force to continue.
Aborted due to warnings.
Not exactly sure what's up but obviously a communication issue between Ruby and Compass?
Whether it be incorrect version mapping or paths..?
I researched and attempted following:
Uninstalled the current and installed new Ruby
Installed RVM (didn't use it, just installed it)
Upgraded compass to the latest version 0.12.2 and made sure this version is reflected in package.json for grunt.
Any pointers and advise highly appreciated!
I don't know if this is an option but you might look at PrePros (https://github.com/sbspk/Prepros). I tried for a while to setup the raw/core setup you are working with but it was just always quirky - not to mention super tedious to setup. PrePros takes all the pain away! Just a suggestion.
Related/Reference link: https://stackoverflow.com/questions/19866550/sass-haml-compile-on-prepros

Sass --compass --watch Error: Cannot load compass

I am working with sass and compass and trying to use the new sourcemap feature as Chrome 27 requires the new method of sourcemap to show the actual sass files and line numbers in the chrome console panel.
I am able to run the following sass command sass --sourcemap --watch style.scss:style.css
however if I append the --compass argument like the following sass --compass --sourcemap --watch style.scss:style.css
I get the following error in the windows cmd panel: "ERROR: Cannot load compass".
I have tried following some of methods that apparently worked for some people on the github issue page https://github.com/chriseppstein/compass/issues/1108
The methods I have tried are using the sass 3.3.0.alpha.177 with compass 0.12.2 (this producers an error every time I try and execute the compass gem which is almost identical to this issue Why does "compass watch" say it cannot load sass/script/node (LoadError)?)
Currently my setup is the following:
sass 3.3.0.alpha.177
compass 0.13.alpha.4
Windows 7
Is there a way that I can use Sass with compass and at the same time generate the sourcemaps which are needed for css debugging?
I found that I had two versions of Sass installed (3.4.25 and 3.5.5). I was getting the error when using grunt which was using the latest version 3.5.5. I resolved the problem by uninstalling 3.5.5.
gem uninstall sass
→
Select gem to uninstall:
1. sass-3.4.25
2. sass-3.5.5
3. All versions
Works with Sass 3.3.0.alpha.149 and compass 0.12.2 on windows 7
The versions mentioned by #lollerskates666 work, but I had to specifically remove sass version 3.3.4 which came down when I installed compass.
If anyone else if having this difficulty, I had to run the following rules to get it working:
gem install compass --version 0.12.2
This installs compass and also Sass 3.3.4 (Maptastic Maple). These two versions, combined with --sourcemap don't seem to play nicely, so you'll need to install an older version of Sass:
gem install sass --pre --version 3.3.0.alpha.149
Although you've now installed it, if you run:
sass --v
Ruby will still be using Sass version 3.3.4, so you'll need to uninstall this version:
gem uninstall sass
**Select number assigned to version 3.3.4**
Now, if you run:
sass --v
You should see:
Sass 3.3.0.alpha.149 (Bleeding Edge)
Sass should now work with the compass lib and also produce sourcemaps, which Chrome can read :)
I run this command to watch my scss files:
sass --watch --sourcemap --compass --style compressed scss:css
Hope this helps!!
** I'm running this on a Mac, but the same versions work fine :)
Had this problem as well. gem 'sass', '~> 3.2.19' was working on a previously created application. I resorted to using that instead of gem 'sass', '~> 3.4.16 which was automatically generated at creation time for a 3.2.22 app and which generated this problem.
So there does appear to be an issue with the version.

Installing Sass on Gentoo

I've been trying to install Sass on Gentoo, but it hasn't been going too well. Unfortunately, the latest version of Sass in portage is 3.1.21.
What I want to use Sass for requires at least Sass 3.2, which is available through rubygems.
What I've tried:
emerge dev-ruby/sass (installs an old version)
gem install sass
The second command appears to install the Sass gem. However, I do not use Rails or Ruby in any other aspect apart from Sass, so the gem appears useless to me. In addition, I do not know where gems are installed to or how to use them (I'm a ruby noob.) All I want to do is call sass from the command line.
Are there any ways to obtain an up-to-date version of Sass which I can just use from the command line?
Cheers.
On Gentoo, user-installed gems are not in your PATH by default. I have created a bug report because while user-installed gems work much better than they used to, this problem really needs to be rectified. You can help by voicing your opinion in the report and linking back to this page. To get things working, you can either deploy the script I uploaded to the report or use RVM instead, which will give you much more consistent behaviour across distros.
I'm wondering but all the answers looks weird for me. One of the biggest gentoo advantage is ebuild writing which is easy as pie so every user can contribute whatever he needs.
Add local overlay
fork upstream ebuild to your local overlay
bump version
use
test
attach tested ebuild to bug report, maybe also contact someone on #gentoo-dev-help
Trust me, using gem (or cabal, or whatever) instead of your package manager if way to mess your system.
Some might find useful to know that under Gentoo you can install sass using emerge which will solve the PATH problem some people are encountering.
# emerge -av sass
after which you should be able to use sass without problem.
Another solution would be to use rvm which could make things more portable and uniform across environments.
edit: in case someone's asking: to install rvm just follow the instructions found at: https://rvm.io/rvm/install/ and install the stable version.
I don't see a down side to using the gem version of Sass. I'm also not a Ruby/RoR developer (I use Haskell/PHP), and I just use the gem. I know just enough about gems to install/uninstall them, and that seems good enough for using Sass.
Installing and upgrading Sass is done with the same command:
sudo gem install sass
Installing Sass via gems gives you the ability to use it via command line, just like it shows on the official website: http://sass-lang.com/.
sass --watch style.scss:style.css
Other command line options can be found via --help or on their docs: http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#using_sass
sass --help
Consider using compass it will accepts command lines like: compass [YOUR-FILE].sass and can also compass watch [SASS FOLDER] and 'compile' css to it.
http://compass-style.org/
To install using a gem
gem update --system
gem install compass
Installation

Resources