gulp-compass asking for Ruby and Compass in PATH when they are already there - bundler

I'm trying to get gulp-compass to work on my Debian linux but am getting an error message stating that Ruby and Compass must be in the path. I am a bit of a beginner when it comes to Gulp so is probably me being stupid.
The following is the exact error message I get when running the task I create in my Gulpfile:
events.js:85
throw er; // Unhandled 'error' event
^
Error: You need to have Ruby and Compass installed and in your system PATH for this task to work.
Process finished with exit code 1
I've looked through other similar questions that suggest doing a gem install compass and a gem install sass but neither seem to work for me.
My Gulpfile is as follows:
var gulp = require('gulp'),
compass = require('gulp-compass');
gulp.task('stylesheets', function(){
return gulp.src('**/*.scss')
.pipe(compass({
config_file: './config.rb',
css: 'css',
sass: 'sass'
}))
.pipe(gulp.dest('css'));
});
I can runruby -v and compass -v I can see that these are correctly in my path and doing an echo $PATH shows that ruby is definitely there.
I am wondering if it is a problem to do with me installing ruby with RVM or the fact that I am using Bundler to install the gems in my project. My Gemfile is as follows:
source 'https://rubygems.org'
gem 'susy'
gem 'compass'
gem 'breakpoint'
I have installed the gems with bundle install and have also tried the bundle_exec: true option in gulp-compass (though truth be told I don't really know what this is for not being a Bundler expert). I have tried re-installing Ruby.
Has anyone any idea as to why I am getting the above error message? I've never had errors like this when doing similar with Grunt.

I've finally managed to get round this. I uninstalled RVM with rvm implode and then installed Ruby again with a regular apt-get install ruby.
Once I did this it all worked fine. I had to make a minor tweak to my gulpfile so it is now:
var gulp = require('gulp'),
compass = require('gulp-compass');
gulp.task('stylesheets', function(){
console.log();
return gulp.src('sass/**/*.scss')
.pipe(compass({
config_file: './config.rb',
css: 'css',
sass: 'sass'
}))
.pipe(gulp.dest('css'));
});
This isn't exactly an ideal as I'm now stuck with an older version of Ruby (ruby 2.1.5p273) when the current stable release (at time of writing) is 2.2.2. I'd rather use RVM but this will do for now.

Related

How to implement Compass, Sass to a node.js project?

i have recently implemented the grunt task runner on my Node.js project and i'm using grunt-contrib-compass and grunt-contrib-watch in order to compile my sass and compass code through grunt whenever i make any changes.
My grunt file is like this:-
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dist: {
options: {
sassDir: 'public/sass',
cssDir: 'public/css'
}
}
},
watch: {
css: {
files: '**/*.scss',
tasks: ['compass']
}
}
});
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default',['watch']);
}
I'm using windows and whenever i run grunt it watches for my sass files but whenever i make a change to these files i get this error:-
Warning: Couldn't find the 'compass.bat' binary. Make sure it's installed and in you $PATH Use --force to continue
I have installed ruby and compass through the ruby command prompt and the compass version is 1.0.3 and my gem installer version is 2.4.6. I have also tried including c:\Ruby200\bin to my Environmental variables and yes grunt-contrib-compass is installed in my Node.js project. I have tried everything, if anyone else has any experience in this i would love to hear from you. Thanks a lot.
You just need to install Ruby and follow this steps:
npm install grunt-contrib-compass
Reinstall Ruby gem installer 1.9.3 with checked all checkbox
On ruby console - gem install sass
On ruby console - gem install compass

Sass builds/compiles very slowly (also using Compass) [duplicate]

Since updated to the latest version of Compass it now takes 4.294s to compile.
I need this version of compass due to needed susy
Running "sass:dist" (sass) task
Running "watch" task
Completed in 4.294s at Tue Sep 30 2014 23:38:01 GMT+0200 (W. Europe Daylight Time) - Waiting...`
// Running versions
compass -v 1.0.1
susy -v 2.1.3
sass -v 3.4.4
I compile with grunt:
sass: {
dist: {
options: {
style: 'compressed',
require: 'susy',
compass: true
},
files: {
'<%= yeoman.css %>/style.css': '<%= yeoman.sass %>/style.scss'
}
}
}
How can I speed up the compile time? Is it something wrong with my config?
It's not a config problem, it's a known performance regression in the latest Sass & Compass.
Having the same problem, pulling my hair out to find a solution but and finally found one; It is to downgrade.
From 2mins+ of compiling to 25s.
Here's How:
You need to install these (if your using OSX):
http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages
Install Bundle
gem install bundle
Make a Gemfile in your root folder, name it "Gemfile"
# frozen_string_literal: true
source "https://rubygems.org"
# gem "rails"
gem 'sass', "3.2.9"
gem 'sass-globbing', ">= 1.1.0"
gem 'compass', "0.12.2"
gem 'breakpoint', "2.0.5"
gem 'singularitygs', "< 2.0.0"
gem 'bootstrap-sass'
Install GemFile and update it
bundle install && bundle update
Then to run compass with bundle
time bundle exec compass compile <path>
I'm keeping my versions like these for a while, until they fix the performance issues. Hope it helps!

Compass taking too long to compile

Since updated to the latest version of Compass it now takes 4.294s to compile.
I need this version of compass due to needed susy
Running "sass:dist" (sass) task
Running "watch" task
Completed in 4.294s at Tue Sep 30 2014 23:38:01 GMT+0200 (W. Europe Daylight Time) - Waiting...`
// Running versions
compass -v 1.0.1
susy -v 2.1.3
sass -v 3.4.4
I compile with grunt:
sass: {
dist: {
options: {
style: 'compressed',
require: 'susy',
compass: true
},
files: {
'<%= yeoman.css %>/style.css': '<%= yeoman.sass %>/style.scss'
}
}
}
How can I speed up the compile time? Is it something wrong with my config?
It's not a config problem, it's a known performance regression in the latest Sass & Compass.
Having the same problem, pulling my hair out to find a solution but and finally found one; It is to downgrade.
From 2mins+ of compiling to 25s.
Here's How:
You need to install these (if your using OSX):
http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages
Install Bundle
gem install bundle
Make a Gemfile in your root folder, name it "Gemfile"
# frozen_string_literal: true
source "https://rubygems.org"
# gem "rails"
gem 'sass', "3.2.9"
gem 'sass-globbing', ">= 1.1.0"
gem 'compass', "0.12.2"
gem 'breakpoint', "2.0.5"
gem 'singularitygs', "< 2.0.0"
gem 'bootstrap-sass'
Install GemFile and update it
bundle install && bundle update
Then to run compass with bundle
time bundle exec compass compile <path>
I'm keeping my versions like these for a while, until they fix the performance issues. Hope it helps!

Running a compass task with gulp results in a LoadError

When running a compass task with Gulp (on OSX), I receive the following error. I've tried installing specific versions of both compass and sass (in various orders) without any notable effect.
[17:25:46] LoadError on line ["54"] of /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb: cannot load such file -- compass/import-once/activate
Run with --trace to see the full backtrace
events.js:72
throw er; // Unhandled 'error' event
^
Error: Compass failed
at Transform.<anonymous> (/Users/liamegan/Projects/WTC/nintendo.wethecollective.com/html/Websites/Kids/web/node_modules/gulp-compass/index.js:37:28)
at ChildProcess.<anonymous> (/Users/liamegan/Projects/WTC/nintendo.wethecollective.com/html/Websites/Kids/web/node_modules/gulp-compass/lib/compass.js:136:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
My compass version is 0.12.7 and my sass version is 3.3.13 however I've also tried with sass 3.2.19.
My sass gulp process is as follows:
gulp.task('sass', function() {
gulp
.src('./_src/sass/screen.scss')
.pipe(compass({
config_file: './config.rb'
}))
.pipe(gulp.dest('./assets/css'))
})
Any help or insight would be greatly appreciated.
Cheers,
L
I fixed this with the following:
sudo gem uninstall sass
sudo gem uninstall compass
sudo gem install sass
sudo gem install compass --pre
This installed the prerelease version of compass which works with the latest, stable version of sass.

Load error with Susy - Sass - Compass - watch

I have compass 1.0.0.alpha.18 installed with Sass 3.3.2 and Susy 2.0.0 and get
"Loaderror on line["45"] of C: cannot load such file --wdm"
The process that I am trying in the console is this:
gem install sass
gem install compass
When I do this, it tells me "successfully installed compass-0.12.3 but if I run compass --version I get Compass 1.0.0.alpha.18.
gem install susy
compass watch [my sass folder]
Returns: Compass is watching for changes
overwrite ../css/styles.css
Loaderror on line["45"] of C: cannot load such file --wdm
Any help would be greatly appreciated.

Resources