Giter VIP home page Giter VIP logo

gulp-compass's Introduction

gulp-compass

NPM version Downloads Build Status Dependency Status Coverage Status

NPM

Compile Sass to CSS using Compass

Requirements

gulp-compass requires the compass ruby gem in order to compile compass. This can easily be installed via Terminal.

$ gem update --system
$ gem install compass

Please refer the user guide

Installation

Install with npm

$ npm install gulp-compass --save-dev

Usage

Load config from config.rb

Please make sure to add css and sass options with the same value in config.rb since compass can't output css result directly.

  • css default value is css.
  • sass default value is sass.
var compass = require('gulp-compass');

gulp.task('compass', function() {
  gulp.src('./src/*.scss')
    .pipe(compass({
      config_file: './config.rb',
      css: 'stylesheets',
      sass: 'sass'
    }))
    .pipe(gulp.dest('app/assets/temp'));
});

Load config without config.rb

set your project path.

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'));
});

set your compass settings.

var compass = require('gulp-compass'),
  minifyCSS = require('gulp-minify-css');

gulp.task('compass', function() {
  gulp.src('./src/*.scss')
    .pipe(compass({
      css: 'app/assets/css',
      sass: 'app/assets/sass',
      image: 'app/assets/images'
    }))
    .pipe(minifyCSS())
    .pipe(gulp.dest('app/assets/temp'));
});

Support multiple require option

var compass = require('gulp-compass'),
  minifyCSS = require('gulp-minify-css');

gulp.task('compass', function() {
  gulp.src('./src/*.scss')
    .pipe(compass({
      css: 'app/assets/css',
      sass: 'app/assets/sass',
      image: 'app/assets/images',
      require: ['susy', 'modular-scale']
    }))
    .pipe(minifyCSS())
    .pipe(gulp.dest('app/assets/temp'));
});

Support return the output of the Compass as the callback

var compass = require('gulp-compass'),
  minifyCSS = require('gulp-minify-css');

gulp.task('compass', function() {
  gulp.src('./src/*.scss')
    .pipe(compass({
      css: 'app/assets/css',
      sass: 'app/assets/sass',
      image: 'app/assets/images'
    }))
    .on('error', function(error) {
      // Would like to catch the error here
      console.log(error);
      this.emit('end');
    })
    .pipe(minifyCSS())
    .pipe(gulp.dest('app/assets/temp'));
});

gulp-compass with gulp-plumber

var compass = require('gulp-compass'),
  plumber = require('gulp-plumber'),
  minifyCSS = require('gulp-minify-css');

gulp.task('compass', function() {
  gulp.src('./src/*.scss')
    .pipe(plumber({
      errorHandler: function (error) {
        console.log(error.message);
        this.emit('end');
    }}))
    .pipe(compass({
      css: 'app/assets/css',
      sass: 'app/assets/sass',
      image: 'app/assets/images'
    }))
    .on('error', function(err) {
      // Would like to catch the error here
    })
    .pipe(minifyCSS())
    .pipe(gulp.dest('app/assets/temp'));
});

Configuration

Configuration Options

style

default: nested

description: The output style for the compiled css. One of: nested, expanded, compact, or compressed.

comments

default: false

description: Show line comments or not.

relative

default: true

description: Are assets relative.

css

default: css

description: The target directory where you keep your css stylesheets. It is relative to the project option.

sass

default: sass

description: The source directory where you keep your sass stylesheets. It is relative to the project option.

javascript

default: js

description: The directory where you keep your javascripts. It is relative to the project option.

font

default: font

description: The directory where you keep your fonts. It is relative to the project option.

project

default: your project base

description: The location where all your assets are store.

logging

default: true

description: show/hide compile log message.

import_path

default: false

format: string or array

description: The directory where you keep external Compass plugins or extensions that you would like to make available using the @import function. Common use case would be setting this to your bower_components directory for example. It is relative to the project option.

require

default: false

format: string or array

description: Require the given Ruby library before running commands. This is used to access Compass plugins without having a project configuration file.

load_all

default: false

description: Load all the frameworks or extensions found in the FRAMEWORKS_DIR directory.

bundle_exec

default: false

description: Run compass compile with bundle exec: bundle exec compass compile.

sourcemap

default: false

description: Generate standard JSON source maps.

PS. Past compass versions (prior to 1.0.0) do not support --sourcemap flag, please update sass and compass as the following version.

* sass (3.3.3)
* compass (1.0.1)

time

default: false

description: Display compilation times.

debug

default: false

description: Turns on sass's debuging information.

environment

description: The environment mode can also be development or production.

http_path

default: false

description: Set this to the root of your project when deployed.

generated_images_path

default: false

description: GENERATED_IMAGES_PATH. Support --generated-images-path parameter.

task

default: compile

description: Support compass primary commands: compile or watch.

Running tests

$ gem install compass
$ gem install susy
$ gem install sass-globbing
$ gem install modular-scale
$ npm test

gulp-compass's People

Contributors

appleboy avatar dotnetcarpenter avatar fjandin avatar gigafied avatar greenkeeperio-bot avatar hyperatom avatar jannisg avatar jleplomet avatar ksubileau avatar leevigraham avatar mtorromeo avatar quaderi avatar steffenmllr avatar sun-zheng-an avatar tomlea avatar wmartins avatar yleviel avatar yocontra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-compass's Issues

Individual stylesheets must be in the sass directory.

Seeing errors on OSX with the latest copy of compass.
compass compile runs fine, but gulp-compass is failing with the below output:

[13:14:50] Individual stylesheets must be in the sass directory.
events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Compass failed

gulpfile.js

// directories
var sassDir = 'app/assets/sass',
    coffeeDir = 'app/assets/coffee',
    targetCSSDir = 'public/css',
    targetJSDir = 'public/js';

gulp.task('css', function () {
    return gulp.src(sassDir + '/global.sass')
        .pipe(compass({
            sass: sassDir,
            css: targetCSSDir
        }).on('err', function (err) {
            console.log(err);
        }))
        .pipe(gulp.dest(targetCSSDir))
        .pipe(notify('CSS compiled, prefixed, and minified'));
});

config.rb

http_path = "./"
css_dir = "public/css"
sass_dir = "app/assets/sass"
images_dir = "public/img"
javascripts_dir = "public/js"

# path to source files
project_path = "./"

# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
output_style = :expanded

# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = true

NoMethodError on line ["59"] -- Can't compile

Having issue compiling with gulp-compass -- is there a way to specify which compass gem is used for compiling?

NoMethodError on line ["59"] of /Users/**/.gem/ruby/2.0.0/gems/compass-core-1.0.0.alpha.17/lib/compass/core/sass_extensions/functions/env.rb: undefined method `version' for #<Compass::Frameworks::Framework:0x007ffbba60ee20>

1.3.* integration with gulp-plumber

After version 1.2.0 your plugin stopped working with gulp-plumber. When there is an SCSS error, the task breaks.

I really appreciate your work on this project.

Thank you.

specifiying multi level paths

I'm trying to compile scss files across a multi level folder structure.

But I doesn't work after trying many variations in the sass: options.

for example:

styles/external/*
styles/project/*
styles/project/widget1/*
styles/project/widget2/*

Where star indicates where the files are located.
:"You must compile individual stylesheets from the project directory."

var gulp = require('gulp'),
gutil = require('gulp-util'),
compass = require('gulp-compass');

var sasSources, htmlSources, outputDir;
// htmlSources = [outputDir + '.html']
sassSources = ['app/styles/main.scss'];
// sassSources = ['app/sass/main.scss'];
sassStyle = 'compressed';
outputDir = 'deploy';
gulp.task('compass', function() {
gulp.src(sassSources)
.pipe(compass({
sass: 'app/styles/{,
/}{,/}',
// sass: 'app/sass',
style: sassStyle
}))
.pipe(gulp.dest(outputDir + 'css'))
.on('error', gutil.log)
// .pipe(connect.reload())
});
gulp.task('default', ['compass']);

Any ideas?

Nested changes not getting caught

Hi, my project structure is like this:

screen.scss (imports "modules/all")
-- modules (dir)
--- _all.scss (imports all modules)
--- _other_modules.scss
--- _other_modules2.scss

and my compass gulp task looks like this:

var sassSrc = 'assets/src/sass/**/*.scss';

gulp.task('compass', function() {
    return gulp.src(sassSrc)
        .pipe(compass({
            config_file: 'config.rb',
            css: 'assets/css',
            sass: 'assets/src/sass'
        })).on('error', function(err) {
            console.log(err);
        })
        .pipe(gulp.dest('assets/css'));
});

gulp.task('watcher', function() {
    gulp.watch(sassSrc, ['compass']);
});

gulp.task('default', ['watcher', 'compass']);

When I make a change to one module, the watcher detects it but the changes are not reflected, but if I change screen, the changes are picked up. Does gulp-compass has any trouble with recursive src's?

gulp-compass option path cause Compass Failed

this will fail...
( but it worked on gulp-compass 1.2.0 )

gulp.task('compass', function () {
    gulp.src('./sass/*.scss')
        .pipe(compass({
            css: './css',
            sass: './sass',
            images: './img',
            time: true
        }))
        .pipe(gulp.dest('./css'));
});

but remove ./ ,
the one works.

is it the same with #61 ?

gulp.task('compass', function () {
    gulp.src('sass/*.scss')
        .pipe(compass({
            css: 'css',
            sass: 'sass',
            images: 'img',
            time: true
        }))
        .pipe(gulp.dest('css'));
});

Compass import issue

When I used @import "compass" in sass and include stretch mixin, I got the Error error src/stylesheets/application.sass (Line 10: Undefined mixin 'stretch'.)

However, it's work when I used @import "compass/layout".
I think that it doesn't make sense. Please check it out.

How to remove debug info

I haven't been able to get the compass task to compile without the debug info. I've tried several variations of my task. Here is what the basic task looks like:

gulp.task('compass', function() {
  gulp.src('./sass/*.scss')
    .pipe(compass({
      config_file: './config.rb',
      css: 'stylesheets',
      sass: 'sass',
      debug: false
    }))
    .pipe(gulp.dest('temp'));
});

My config is:

http_path = "./"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
output_style = "compressed"
line_comments = false

Thanks.

Watch task stops when there's a Compass error

If there's a Compass compilation error, instead of simply reporting the error the task stops completely. Is this by design? It's quite annoying having to restart the task every time I get a Compass error (which is not often, but still...).

screen-shot-2014-03-18-at-11 48 12

Can't process the output of the gulp-compass task.

I'm trying to get the gulp-compass version 1.0.1 into my gulp build stream but am having issues working with the output of the compass compiler.

Here is the gulp task I've got which should:

  1. Find all .scss files.
  2. Process with compass
  3. Run autoprefixer over the resulting css
  4. Write to .css file
  5. Trigger livereload
  6. Output the .css filesize to console.
gulp.task('styles', function() {
  gulp
    .src('assets/scss/**.scss')
    .pipe( tasks.compass( { config_file: './config.rb' } ) )
    .pipe( tasks.autoprefixer( 'last 2 versions', 'ie 8' ) )
    .pipe( gulp.dest('assets/css') )
    .pipe( tasks.livereload(server) )
    .pipe( tasks.filesize() );
});

The issue I'm experiencing is that after .pipe( tasks.compass( { opts } ) ) has run, autoprefixer does not trigger, nor does the livereload or filesize tasks.
The compass output does however get written to the .css file as desired.

Note: Livereload by itself is working, coffeescripts are successfully compiled and the livereload is triggered so the module in itself is working.

Any ideas would be much appreciated.

Output Two CSS Files?

New to Gulp, sorry :) Can this be configured to output two files, an expanded CSS file with source maps etc, as well as a minified .css.min file?

Thank you.

Path configuration like in gulp-sass?

Shouldn't paths (I'm talking about {css:'path/to/css', sass:'path/to/sass}) be resolved with gulp.src and gulp.dest like in gulp-sass plugin? So you have to only add .pipe(compass()) and left src and dest to be determine by gulp? Or I'm understanding something wrongly? :)

add sass-cache: false argument

gulp.task('compass', function(cb) {
  return gulp.src(paths.sass)
    .pipe(compass({
      sass: 'dev/sass',
      css: 'build/source',
      image: 'img',
      cache: false // in order to disable caching, optional
    }))
})

Source map on compass-1.0.0.rc.1

I've just update compass to Compass 1.0.0.rc.1 (Polaris) on Ubuntu 14.04 and gulp-compass outputs source map no matter what. Sass version is Sass 3.4.0 (Selective Steve).

No files were found in the load path matching "icons/*.png"

gulpfile.js

gulp.task('sass', function () {
  gulp.src(['src/sass/*.sass'])
      .pipe(compass({
        project: __dirname,
        css: 'production/css',
        sass: 'src/sass',
        image: 'production/images/',
        relative: true
      }));
});

main.sass

@import "icons/*.png"

console

[gulp] Using file C:\Users\Vlad\Desktop\psd2html\gulpfile.js
[gulp] Working directory changed to C:\Users\Vlad\Desktop\psd2html
[gulp] Running 'default'...
[gulp] Running 'sass'...
[gulp] Finished 'default' in 6.08 ms
[gulp] No files were found in the load path matching "icons/*.png". Your current load paths are: C:\Users\Vlad\Desktop\psd2html/production/images

[gulp] Finished 'sass' in 1 s

Syntax errors using .sass

When I try to use multiline comments like

/*
Multiline
Comments
*/

It happens this

Syntax error: Invalid CSS after "*\/": expected identifier, was ""

Map structures

$list:
    (1,  "value"),
    (5,  "value"),
    (23, "value")

It happens this

Syntax error: Illegal nesting: Nothing may be nested beneath variable declarations.

@debug

@debug 10em + 12em

Compile the sass but don`t debug nothing.

Is there a way to support `httpGeneratedImagesPath` option like grunt-contrib-compass?

Generally, we write compass sprite code like this in our src directory:

@import "icons/*.png";

.icon-hom {
  @include icons-sprite(home);
}

and it will be compiled to this:

.icon-home, .icon-tools, .icon-heart {
  background: url(../../../src/p/home/images/icons-s019adab402.png) no-repeat;
}

.icon-home {
  background-position:0 -465px;
}

Did you notice the background-url? It's relative path, but we also need an absolute path in production.

And with grunt-contrib-compass, It has a httpGeneratedImagesPath option to support this, you can get this option in here.

So, Is there a way to support httpGeneratedImagesPath option like grunt-contrib-compass?

Thanks for your reply!

bundle_exec isn't importing compass extensions

When I run the bundle exec compass compile I get a full compilation with no errors, however I'm trying to use gulp and gulp-compass and I'm still unable to compile, even when using bundle_exec: true .

Instead, I keep getting told that it can't recognize imports of singularitygs, toolbox, and sassy-buttons. Whenever I comment them out, it doesn't recognize the methods and variables associated with them. I have them all declared in my config.rb and in my Gemfile.

I'm also using gulp-ruby-sass and I tried the settings bundleExec: true , and that still did nothing.

I've been stumped over this for almost 20 hours now.

I posted a full rundown of the problem already on stackoverflow yesterday, but figured I would post here as well, cause surely I'm not the only person to run into this.

http://stackoverflow.com/questions/23398603/gulp-isnt-noticing-sass-compass-extension-imports-bundler

Sourcemap integration

Hey,

I am trying to integrate Sass sourcemap but it is not working and I get this error when I try to run gulp.

Error: invalid option: --sourcemap

This is how my configuration looks like:

gulp.task('styles', function() {
     gulp.src(dirSass + '/style.scss')
        .pipe(compass({
             css: dirStyles,
            sass: dirSass,
            image: dirImagesDest,
            sourcemap: true
        }))
        .pipe(minifycss())
        .pipe(rename('style.min.css'))
        .pipe(gulp.dest(dirStyles))
        .pipe(notify('Styles are updated Master.'))
        .pipe(livereload());
});

Should this work like this?

Compass version: Compass 0.12.6 (Alnilam)
Sass version: Sass 3.3.7 (Maptastic Maple)

A little bug with gulp-compass and gulp.watch

Hey,

I have been using gulp-compass and but I have a little problem using gulp.watch in combination with gulp-compass.

Using this compass script, gulp.watch run as expected:

gulp.task('compass', function() {
    return gulp.src('src/sass/**/*.scss')
        .pipe(compass({
            css: 'src/css',
            sass: 'src/sass',
            image: 'src/images'
        }))
        .pipe(gulp.dest('build/dev/css'));
        //.pipe(minifyCSS())
        //.pipe(gulp.dest('build/production/css'))
        //.pipe(notify({ message: 'Compass task complete' }));
});

But, when I uncomment the three lines above, compass is not executed at all using gulp.watch, but when gulp runs by first time, all works good. It's an issue only with gulp.watch and those 3 lines..

gulp.task('compass', function() {
    return gulp.src('src/sass/**/*.scss')
        .pipe(compass({
            css: 'src/css',
            sass: 'src/sass',
            image: 'src/images'
        }))
        .pipe(gulp.dest('build/dev/css'))
        .pipe(minifyCSS())
        .pipe(gulp.dest('build/production/css'))
        .pipe(notify({ message: 'Compass task complete' }));
});

Any idea?

Add option for raw compass config data

The grunt-contrib-compass module has a raw option which allows you to parse in additional configuration options (written in ruby) that are otherwise unavailable. This would be very useful in gulp-compass.

Compass doesn't expose all of its options through the CLI, which this task makes use of. If you need an option not mentioned below you can either specify a path to a config.rb file in the config option or embed it directly into the raw option. Options defined in your Gruntfile will override those specified in your config.rb or raw property. config and raw are mutually exclusive.

For example, with grunt I use this to specify a custom asset_cache_buster method.

Gulp-compass compressing sass not working

Running Sass 3.4.3, Compass 1.0.1, Gulp 3.8.8 and Gulp-compass 1.3.1

var gulp = require('gulp');
var compass = require('gulp-compass');
var gutil = require('gulp-util');

 gulp.task('compass', function() {
        gulp.src('comp/sass/style.scss')
            .pipe(compass({
                sass: 'comp/sass',
                image: 'dev/theme/images',
                style: 'compressed'
            })
            .on('error', gutil.log))
            .pipe(gulp.dest('dev/theme/css'))
    });

compass Task is compiling the sass but compression is not working. It output a normal uncompressed css file.

Sourcemaps keep generated

Hi there,

with the option to disable the sourcemaps, and debug posting no --sourcemaps param for the compass command, still the sourcemaps are generated.

Compass 1.0.0.rc.0 (Polaris)

"Individual stylesheets must be in the sass directory."

Getting an error and I don't know if or what I do wrong:

Individual stylesheets must be in the sass directory.

events.js:72
throw er; // Unhandled 'error' event
^
Error: Compass failed

gulpfile.js:

gulp.task('sass', function() {
    return gulp.src('assets/sass/**/*')
        .pipe(compass({
            config_file: '../config.rb',
            project: __dirname+'/assets',
            css: 'css',
            sass: 'sass'
        }))
        .pipe(gulp.dest('public'));
});

config.rb:

http_path = '/'
project_path = '../assets'
css_dir = 'css'
sass_dir = 'sass'
scss_dir = 'sass'
javascript_dir = 'scripts'
fonts_dir = 'fonts'
images_dir = 'images'
add_import_path = '../bower_components'

file system:

|-- assets
|   |-- css
|   |   |-- style.css
|   |   `-- style.css.map
|   |-- fonts
|   |   |-- varelarnd-regular.otf
|   |   `-- varelarnd-regular.ttf
|   |-- images
|   |   `-- logo.png
|   |-- sass
|   |   |-- _foundation.scss
|   |   |-- _foundation_settings.scss
|   |   `-- style.sass
|   `-- scripts
|       `-- script.js
|-- bower.json
|-- config.rb
|-- gulpfile.js
`-- public
    |-- index.html
    |-- script.js
    |-- script.min.js
    |-- style.css
    `-- style.min.css

Sass 3.4.0.rc.3
Compass 1.0.0.rc.1 (Polaris)
Gulp 3.8.7
Gulp-compass 1.3.0

Problem with nested folders for sass compilation

Hi, me and some folks were discussing in a forum about a strange error with nested folders, so, to start, here is the directory structure (created with compass create and npm init and modified to reproduce the error):

./
 config.rb
 gulpfile.js
 node_modules/
 package.json
 sass/
     base/ - we added this folder to reproduce the problem
          ie.scss
          print.scss
          screen.scss
 css/ - we deleted "stylesheets" and created this folder (don't rename "stylesheets" folder)

Also, our gulpfile.js is very simple, just gulp and gulp-compass with minimal configuration:

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

gulp.task('compass', function() {

    gulp.src('./sass/**/*.scss')
        .pipe(compass({
            config_file: './config.rb'
        }));

});

(Isn't this a problem to not use gulp.dest() to reproduce the error, right? The same error occurs with any configuration.)

Also, here is the config.rb:

http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"

So, when we run gulp, we get the following error:

Error: ENOENT, no such file or directory '/home/<user>/awesome-project/css/<file inside base folder>.css'

We've seen that the generated css files are not relative to the original sass folder were the sass code was located.
I'll submit a pull request with a solution for this problem!

By the way, thank you for this project! Great job!

And thanks to @vitorbritto, @manoelneto and @fdaciuk for helping to investigate this issue.

Add a bundleExec option to allow to specify the compass version by project

Hi,

It's possible to install different version of compass and define which version a particular project should use in a Gemfile by using http://bundler.io/ . To make it work, on the command line you simply need to use bundle exec compass compile instead of compass compile for exemple.

With grunt-contrib-compass I can simply add a bundleExec: true option to make it work. That would be a great option for gulp-compass.

Here is a related issue on grunt-contrib-compass about this option: gruntjs/grunt-contrib-compass#17

Much slower than standard compass command

Hi!

I tried to use gulp-compass, but it is so much slower than invoking compass compile or compass watch. Regular compass compile takes no more than 0.5 sec to compile all the files, with gulp-compass it takes even few seconds.

My task:

gulp.task('compass', function() {
  return gulp.src(SASS_FILES_PATTERN)
    .pipe(compass({
        config_file: path.join(ROOT_PATH, 'config.rb'),
        css: 'css',
        sass: 'sass',
        project: ROOT_PATH,
    }));
});

What could be wrong with this configuration?

src and output different directory

Hi,

I have my src, including images for spriting in /src . However I want this to output to /output after compass completes. Is there a way to do this?

gulp.src('src/style/**/*.scss')
        .pipe(compass({
            css: 'output/style',
            sass: 'src/style',
            image: 'src/assets/images'
        }))
        .pipe(gulp.dest(''));

This more or less works, but the sprite image is generated into /src. Actually gulp.src / gulp.dest don't even seem to be used in any way.

Can i completely separate where files are being pulled from and where they get output to?

sprite-url issue

gulp compile sprite each time when sprite-url called.

gulp-compass output:

screen shot 2014-04-26 at 15 05 18

compass output:

screen shot 2014-04-26 at 15 08 15

Only 16 files piped via src?

Hello.
I am using gulp-compass 1.3.0.
I have this problem.

gulp-compass compiled only 16 files though I have a lot of files.
I use this code.

gulp.src('**/*.sass').pipe(compass({
});

gulp-compass 1.2.0 is OK.

Please tell me how to resolve this.

How to get Compass errors?

Hi,
I need to detect that the Compass has thrown an error. At least, I want gulp-compass to return the output of the Compass as the callback. Currently gulp-compass does not do this, so this would be a feature.

Here is what I tried:

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

gulp.task('compass', function() {
    gulp.src('assets/scss/**/*.scss')
        .pipe(
            compass({
                style: 'nested',
                comments: true,
                sass: 'assets/scss',
                css: 'public/css'
            }).on('error', function(err) {
                // Would like to catch the error here
            })
        );
});

Here is an example of faulty written SCSS:

.something {
    color blue;
}

I expect the gulp-compass to emit an error event and return this kind of error to my callback:

error assets/scss/app.scss (Line 2: Invalid CSS after "        color blue": expected "{", was ";")

Compass failed: You must compile individual stylesheets from the project directory.

I am getting the following error

[gulp] gulp-notify: [Error running Gulp] Compass failed
[gulp] You must compile individual stylesheets from the project directory.

File : config.rb

http_path = "/"
css_dir = "app/assets/src/stylesheets"
sass_dir = "app/assets/stylesheets"
images_dir = "app/assets/images"
javascripts_dir = "app/assets/javascript"

File : gulp.js

.pipe($.compass({
    config_file: './config.rb',
    css: 'app/assets/src/stylesheets',
    sass: 'app/assets/stylesheets',
    require: [
    'bourbon',
    'singularitygs'
    ],bundle_exec:true}))

Error: ENOENT, no such file or directory

Hello I am using gulp-compass 1.0.9 and have this problem

Error: ENOENT, no such file or directory '/Users/tiago.porto/gulp-template/src/stylesheets/style.css'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at Transform. (/Users/tiago.porto/gulp-template/node_modules/gulp-compass/index.js:35:43)
at ChildProcess. (/Users/tiago.porto/gulp-template/node_modules/gulp-compass/lib/compass.js:103:13)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket. (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)

gulp-compass + require('require-dir) does not compile

Do not pay attention to clumsy words, I use Google translator.
The project looks like this -
_002
_gulpfile.js_

'use strict';

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

gulp.task('compass', function(){
        var compassSettings = {
            config_file:'./config.rb',
            css:'./app/dev/css/',
            scss:',/app/src/scss/'
        }

        gulp.src('./app/src/scss/')
        .pipe(compass(compassSettings))
        .pipe(gulp.dest('./app/dev/css'))
})
gulp.task('default', ['compass']);

_config.rb_

http_path = "/"
css_dir = "app/dev/css"
sass_dir = "app/src/scss"
images_dir = "app/src/assets/images"
javascripts_dir = "app/src/scripts"

In this case scss is not compiled in css, but in directory _/app/dev/css/_ Why-you created a directory scss/ without files. Why and how to fix it?

It was the first. The second problem is that I need to describe the task to gulp in directory _gulp-tasks/_ I connect to _gulpfile.js_ -

require('require-dir)('./gulp-tasks/');

_gulpfile.js_

'use strict';

var gulp = require('gulp');
           require('require-dir')('./gulp-tasks/');

gulp.task('default', function(){
    gulp.start('build');
});

File _gulp-tasks/build-task.js_

gulp.task('compass', function(){
    return gulp.src('../app/src/scss')
    .pipe(plumber({ErrorHandler:notify.onError("<% error.message %>")}))
    .pipe(compass({
        config_file:'../config.rb',
        css:'../app/dev/css/',
        scss:'../app/src/scss/'
    }))
    .pipe(gulp.dest('../app/dev/css/'))
});

gulp.task('build', ['compass']);

But in this case nothing happens. :( How to overcome it?

.sass-cache Folder

It would be clean an good practice for the project folder structure to be able, to pass through an option the new/individual folder-location for the .sass-cache -Folder (:cache-location in a compass project file).

can't run gulp-compass

follow the readme and got error:
(installed the lastest version for sass compass gulp and gulp-compass)

[gulp] Using gulpfile ~/Documents/github/Marksimos/gulpfile.js
[gulp] Starting 'compass'...
[gulp] Finished 'compass' after 5.07 ms
[gulp] Starting 'default'...
[gulp] Finished 'default' after 6.64 μs
[gulp] You must compile individual stylesheets from the project directory.


events.js:72
        throw er; // Unhandled 'error' event
              ^
[gulp] Error in plugin 'gulp-compass': Compass failed
    at Transform.<anonymous> (/Users/jinwyp/Documents/github/Marksimos/node_modules/gulp-compass/index.js:37:36)
    at ChildProcess.<anonymous> (/Users/jinwyp/Documents/github/Marksimos/node_modules/gulp-compass/lib/compass.js:137:13)
    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)





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



var paths = {
    javascript: './public/app/js/*.js',
    compass_config : './public/app/css/config.rb',
    sass: './public/app/css/sass/*.scss',
    sasspath: './public/app/css/sass/',
    target_csspath: './public/app/css/stylesheets',
    imagespath : './public/app/css/images'
};


gulp.task('compass', function() {
    gulp.src(paths.sass)
        .pipe(compass({
            css: paths.target_csspath,
            sass: paths.sasspath,
            images: paths.imagespath
        }) )
        .pipe(gulp.dest(paths.target_csspath))
});

gulp.task('compass2', function() {
    gulp.src(paths.sass)
        .pipe(compass({
            config_file: paths.compass_config,
            css: 'stylesheets',
            sass: 'sass'
        }))
        .pipe(gulp.dest(paths.target_css))
});

// Rerun the task when a file changes
gulp.task('watch', function() {
    gulp.watch(paths.sass, ['compass']);
});




// The default task (called when you run `gulp` from cli)
gulp.task('default', ['watch', 'compass']);


.pipe(gulp.dest(dest)) not working since 1.3.3

Since version 1.3.3 no output css file is saved by gulp.dest when it is piped the output from compass.

From what I have seen the file stream result from compass points to the css file in the css directory relative to the sass directory. What I think it should be is a file stream that points to the css file in the css directory relative to the project directory. What it was in versions 1.3.2 is a file stream that points to the css file (in no particular directory, or relative to the project path?).

Allowing compass to run in watch mode

Hi, I just pushed an experimental version here which allows the use of 'watch' option.

I'm currently using it like this...

    gulp
      .src('app/styles/**/*.scss')
      .pipe(
        compass({
          project: __dirname,
          watch: true,
          css: 'assets/css/modules',
          sass: 'app/styles/modules',
          image: 'assets/img',
          import_path: [
              'app/components', 
              'app/styles', 
              'app/styles/modules', 
              'app/styles/modules/' + MODULE
          ],
          require: ['compass']
        })
      );

    // livereload css
    gulp.src('assets/css/**/*.css')
      .pipe(watch())
      .pipe(livereload());

It seems to work well but the gulp.src(paths[MODULE].sass) shouldn't be required.

So... two things.

  1. Is there a better way to make the compile method run?
  2. Do you guys want gulp-compass to go this way? If so, I can make a pull request.

Btw, I bumped the version there to 1.1.6.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.