Search code examples
gulpgulp-compass

Gulp compass without config.rb


I'm struggling to get gulp-compass working correctly without using a config.rb file.

Prerequisites:

  • I don't want to use a config.rb file
  • I need to use compass (can't just use SASS)

The docs say:

var compass = require('gulp-compass'),
path = require('path');

gulp.task('compass', function() {
  gulp.src('./src/*.scss')
    .pipe(compass({
    project: path.join(__dirname, 'assets'),
    css: 'css',
    sass: 'sass'
  }))
  .pipe(gulp.dest('app/assets/temp'));
});

But I can't find the following information anywhere:

  1. What path = require('path') does. This doesn't seem to be a gulp-plugin.
  2. What path.join does exactly.
  3. What __dirname is and should it be changed?

If anyone can clear this up it would be much appreciated.


Solution

  • Path is a Node core module. Its join method allow you to join arguments that will construct a normalised path. __dirname refers to the directory of the file in which it is used.

    Basically it's simply to refers to the assets directory which is in the same folder as your gulpfile.

    By the way, the gulp-ruby-sass plugin has a compass option that you can set to true.