H
H
HamSter2016-04-17 14:23:00
Sass
HamSter, 2016-04-17 14:23:00

Who can help with gulp building for sass compass?

the structure of the project is

www
    app
        sass --> style.scss
        index.html
    dist
        css
        index.html
  gulpfile.js
  pacckage.json
  config.rb

Config.rb is like this
http_path = "/"
css_dir = "css"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "js"

output_style = :expanded 
 relative_assets = true
 line_comments = true

gulpfile.js
'use strict';
 
var gulp = require('gulp'),
  compass = require('gulp-compass');

// Пути
var path = {
  app : {          // Исходники
    html   : 'app/*.html',
    css    : 'app/css/*.css',
    sass   : 'app/scss/style.scss',
    js     : 'app/js/*.js',
    images : 'app/images/**/*.*',
    fonts  : 'app/fonts/**/*.*',
    svg    : 'app/**/*.svg'
  },
  dist : {         // Релиз
    html   : 'dist/',
    css    : 'dist/css/',
    js     : 'dist/js/',
    images : 'dist/images/',
    fonts  : 'dist/fonts/'
  },
  watch : {        // Наблюдение
    html   : 'app/**/*.html',
    css    : 'app/css/**/*.css',
    sass   : 'app/scss/**/*.scss',
    js     : 'app/js/**/*.js',
    images : 'app/images/**/*.*',
    fonts  : 'app/fonts/**/*.*'
  }
};

// Работа с HTML
gulp.task('html', function(){
  gulp.src(path.app.html)
    .pipe(gulp.dest(path.dist.html));
});

// Работа с SASS Compass
gulp.task('compass', function() {
  gulp.src(path.app.sass)
    .pipe(compass({
    	config_file: 'config.rb',
    	css: path.app.css,
    	sass: path.app.sass
    }))
    .pipe(gulp.dest(path.dist.css));
});

// Наблюдение
gulp.task('watch', function () {	
  gulp.watch(path.watch.html, ['html']);
  gulp.watch(path.watch.sass, ['compass']);
});

// Задачи по-умолчанию
gulp.task('default', [
  'html',
  'compass'
]);

1. the question is where should it be located in the app or in the www root?
2. Is it possible to do without this file at all, if so, how?
3. What am I doing wrong?
Mistake
Error: You need to have Ruby and Compass installed and in your system PATH for this task to
work.

Already done both gem update and gem install compass. Ruby is set accordingly.
Most likely, something in gulpfile.js has done something wrong.
If anyone can help or share their compass build please!!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergey, 2016-04-17
@HamSter007

1. the question is where should it be located in the app or in the www root?
fundamentally
2. Is it possible to do without this file at all, if so, how?
no
example:
gulp.task('compass', function() {
  gulp.src('./app/scss/**/*.scss')
    .pipe(debug())
    .pipe(plumber({
      errorHandler: function (error) {
        console.log(error.message);
        this.emit('end');
      }}))
    .pipe(sourcemaps.init())
    .pipe(compass({
      config_file: './config.rb',
      sass: './app/scss',
      css: './app/css'
    }))
    .pipe(debug())
    .pipe(urlAdjuster({
      replace:  ['/app/img','/img']
    }))
    .pipe(minifyCSS({compatibility: 'ie8'}))
    .pipe(debug())
    .pipe(rename('style.min.css'))
    .pipe(csso())
    .pipe(sourcemaps.write('./maps'))
    .pipe(gulp.dest('./dist/css'))
    .pipe(reload({stream: true}));
});

Q
quramolt, 2016-04-17
@quramolt

If it's Windows, then you have paths to Ruby executables, and so on. in environment variables (system environments, it seems) registered? This is necessary so that when you run it from the command line, you can use commands like ruby, gulp, npm, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question