Compass mixins not found when using directly from ruby - ruby

I am building a new ruby script using GLI gem that uses Compass within. However, whenever I run the app using bundle exec SASS/Compass can never seem to find the mixins that I include in my .scss file. I get the following error...
error: File to import not found or unreadable: compass/css3.
I know the solution is to set an environment variable. However, I have no clue as to which variable needs to be set.
Update:
I should have added that this is a follow up to another post that I had - Using Compass from Ruby (not shell)
Here is the code that I am using to invoke compass from my app.
require 'compass'
require 'sass/plugin'
compiler = Compass::Compiler.new('.','.','.',{:style => :compact})
compiler.compile(sass_file,css_file)
Here is the error that is getting thrown
error: File to import not found or unreadable: compass/css3.
Load path: /Volumes/MacRAID/joeworkman/Desktop/stake-test/Badges/Badges.source/Contents
I originally thought that this only happened when I was running under bundle exec. However, its does happen every time even if I were to run in it normally.
Update #2:
I am pretty certain that this is a SASS :load_paths issue. If I set my SASS_PATH environment variable to the below value everything works. I don't want to depend on environment variables though.
~/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets

Make sure that you check out the answers on the below post. Between my findings posted here and the suggestions made on the other post, the question is answered.
Using Compass from Ruby (not shell)

Related

breakpoint (gem) not found or unreadable

I’m using breakpoint within a serve project. After adding require 'breakpoint' to my './config.ru' and #import 'breakpoint' to my stylesheets, breakpoint works well while running serve (which I actually run via Pow).
However, when using serve export to export the site to static HTML/CSS/JS files within a predetermined folder, I get the following error in my stylesheets:
/*
Syntax error: File to import not found or unreadable: breakpoint.
Load paths:
/Users/agarzola/git/devdev-splash/stylesheets
/Users/agarzola/.rvm/gems/ruby-1.9.2-p290/gems/compass-core-1.0.0.alpha.16/stylesheets
Compass::SpriteImporter
on line 5 of ./stylesheets/screen.sass
1: /Users/agarzola/git/devdev-splash/stylesheets/screen.sass
Backtrace:
./stylesheets/screen.sass:5
[…]
*/
I’ve been poking around the serve gem itself and found that export simply runs compass compile -c '#{#input}/compass.config' '#{#input}' to compile stylesheets before copying them to the destination folder. I had also learned some time ago that the export feature in serve does not yet use config.ru (as it should), and I haven’t been able to figure out where exactly I need to tell compass to use the installed breakpoint gem.
So I tried running compass compile -c ./compass.config and compass watch -c ./compass.config, both of which return a similar error:
error stylesheets/screen.sass (Line 5 of screen.sass: File to import not found or unreadable: breakpoint.
Load paths:
/Users/agarzola/git/devdev-splash/stylesheets
/Users/agarzola/.rvm/gems/ruby-1.9.2-p290/gems/compass-core-1.0.0.alpha.16/stylesheets
Compass::SpriteImporter)
I created an issue on the serve project, but I’m hoping someone here can share some much needed insight. Thanks!
I had a similar issue where I have to uninstall the theme and reinstall because for some reason the gems were not being seem. Post here
After I uninstalled the theme, I ran install bundle and then checked rvm requirements. Then I reinstalled the theme and subtheme. I do not use serve however this could be similar enough that it might work. I did not find anything that helped other then that.

Installing the correct environment for Angular with Compass and all other Node dependencies

I am just trying to make a local development environment that isn't on my work computer, and I keep getting an error:
Warning: Errno::ENOENT on line 441 of /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb: No such file or directory - /Users/johnpett/Desktop/Node/app/bower_components
Run with --trace to see the full backtrace Use --force to continue.
I have installed all the Ruby parts and Yeoman to build the app scaffold, but I can't seem to run the 'grunt server' command without throwing up this error.
The error is quite clear, a grunt-plugin require that file...
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb
Anyway ruby components are needed usually if you plan to use compass, if not, you can comment the "compass" sub-task in the "server" task in Gruntfile.js
Your folder was surely not called bower_components at that time. I guess you used yeoman.
In your compass task config you should have modified bower_components.

Finding short path to Foundation

Can someone explain why the short path in my config.rb file isn't compiling:
require 'zurb-foundation' # it fails
But when I specify the full path it does:
require "/Users/lukashillebrand/.rvm/gems/ruby-1.9.3-p327/gems/zurb-foundation-4.2.2/lib/zurb-foundation.rb";
I'm using CodeKit to compile and Foundation 4
The reason is that CodeKit is apparently using the system ruby, and so the relative path is looking there. Your full path is pointing to an rvm version, which is installed elsewhere.
The quick fix is temporarily switch rvm to the system ruby & gemset, and install zurb-foundation there:
$ rvm system
$ sudo gem install zurb-foundation
I do not know zurb, just Ruby as a language/platform, and I think that if that first 'require' throws, then most probably some paths are not set up properly in your server environment.
Is Zurb distributed as a gem? Are other gems found well and are require'able by your code? If not, or if you don't know, try adding
require "rubygems"
as the very first line of your code (well, after some initial shebang and other comments). It should normally be invoked by the framework, somewhere before your file, but as I already said, I don't know Zurb. Maybe it simply does not do that for performance reasons.
Also, run some simple file in the same environment and inspect the $: variable, it should show you the paths that are searched for modules. If in very deadline'y times, you can even temporarily push a new path to it (just replace the '.' with your target path), but it'd be best left as a last resort. Your zurb module seems to sit in Gems, so it should be found automatically.

Error with Compass polling on windows 7

I am attempting to work locally on a PHP application which I cloned from the Git repository my partner and I use.
He uses a Mac, and until now I have been working on the app in a virtual Ubuntu Linux environment. Both environments have been able to use Compass polling with the same file structure and files.
On Windows 7, I run Compass commands from Cygwin, and this is the command I use to have Compass poll from the root directory of the app (C:/wamp/www/application):
compass watch --trace src/Application/ApplicationBundle/Resources/compass/
When I then make a change to a .scss file, I receive the following error:
ArgumentError on line 716 of /usr/lib/ruby/1.8/pathname.rb: different prefix: "/
/cygdrivecwampwwwlimelightsrclimelightlimelightbundleresourcescompasssrcpartials
_object.scss" and "/cygdrive/c/wamp/www/limelight/src/limelight/limelightbundle/
resources/compass/src"
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:81:in 'split_path'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:69:in 'run_callback'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:55:in 'callback_action'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:35:in 'update'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:39:in 'modified'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:37:in 'each'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:37:in 'modified'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:18:in 'refresh'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'each'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:15:in 'loop'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:15:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/monitor.rb:26:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm.rb:20:in 'monitor'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/watch_project.rb:86:in 'perform'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/base.rb:18:in 'execute'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/project_base.rb:19:in 'execute'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:43:in 'perform!'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:15:in 'run!'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:25
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:39:in 'call'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:39
/usr/bin/compass:19:in 'load'
/usr/bin/compass:19
All I've been able to find through searching is that it may have something to do with the fact that Windows capitalizes its drive names, although the lack of slashes in the returned path makes me think the problem may be elsewhere.
Does anyone know why I might receive this error in Windows, but not other platforms?
NOTE: I have found a work-around involving installing ruby (and compass) through Windows' command prompt rather than Cygwin, and that should work fine for now. Still, if anyone has ideas, I'm still curious as to what the problem could be.
According to this commit, this is a problem caused by a compass dependency called FSSM. It is used to monitor file changes in compass. A workaround is described in this comment.
It seems that FSSM detects that ruby is running inside a Windows box, and treats paths in the Windows' way (C:\blabla). Commenting out the line 26 of the file <fssm_gem_path>/lib/fssm/pathname.rb makes compass watch work as expected. You can also add
unless path[0, 1] == File::SEPARATOR
to the end of line 26 to make it work.
I thought I'd just provide a little more info to help people find the pathname.rb file.
On the cygwin prompt type:
gem env
This (unsurprisingly) brings up a load of info about your Ruby Gems installtion. Look for the line which specifies the INSTALLATION DIRECTORY. Mine was:
/usr/lib/ruby/gems/1.8
Now in Windows Explorer navigate to this location but substitute "usr" for your cygwin installation directory. Therefore the above path becomes:
C:\cygwin\lib\ruby\gems\1.8
Once in this location drill down until you come across the fssm gem directory.
Within this [fssm] directory go into:
/lib/fssm/
...and there you should find the pathname.rb file.
Edit it as above and all is well. I hope this helps.
See here for a possible fix:
http://rails.webintellix.com/2010/05/27/error-in-ruby-relative_path_from-call-on-windows/
I was running into this same error with a slightly different setup. My project folder was on a network drive (ruby and sass/compass installed locally), and every time I made a change to a .scss file compass watch would crash with similar errors to the OP. I solved the issue by mapping my network drive instead of accessing it directly via the network (right clicked on My Computer and choose map network drive so I could access my remote drive at A:).
Now, instead of doing 'compass watch //SERVERNAME/My_Project' (I'm using Git Bash), I do 'compass watch a/My_Project' and compass stopped crashing.
Hope that helps someone else.
Using Cygwin, re install a compass dev release (such as 0.13+). Works for me with Compass 0.13.alpha.4 (Markab)
To do so:
gem uninstall compass
gem install compass --pre --no-rdoc --no-ri

Using blueprint.sass in Webby/Compass Integration

I'm following an article here:
http://gom-jabbar.org/articles/2009/02/04/don-t-use-css-or-table-layout-use-sass-ad-compass
more specifically the section entitled "Concrete Example of using
Compass and Sass for creating a layout that people generally use
tables for"
The example references #import blueprint.sass
Where is this file located as my webby project does not seem to be able to find it.
(Also note that I'm using Ubuntu)
My layout.sass file looks like this (nothing fancy):
---
filter: sass
extension: css
layout: nil
---
#import blueprint.sass
body
+blueprint-typography
I get the following error when running webby:
create output/stylesheets/layout.css
[22:56:30] ERROR: while rendering page 'content/stylesheets/layout.sass'
[22:56:30] ERROR: sass filter error: "File to import not found or unreadable: blueprint.sass."
Definitely need to upgrade to the latest edge haml. That was a bug in how comments get parsed that was fixed in the last month or so.
git checkout git://github.com/nex3/haml.git
cd haml
rake install
Alright figured it out...
You have to download/install the most recent installation of haml which isn't yet specified on the compass primer
This should actually be the first step in installing it!
And here is how that step goes:
Download the latest version of HAML with the following command: git clone git://github.com/nex3/haml.git
(This will create a new directory ./haml/)
Change to the ./haml/ directory.
In the ./haml/ directory type the following command: rake install

Resources