Answer the question
In order to leave comments, you need to log in
How to set up gulp-compass?
Hello. There is such a problem. I use Gulp+Jade+Sass. Today I decided to install a compass. I don’t know about you, but in my opinion there is a benefit from it, well, or at least there is no harm. So after reading the manuals, I tried to file it all in gulp. It seems to work, but there are a few nuances. I'll start with the sources:
There is such a gupp.js file
var gulp = require('gulp'),
jade = require('gulp-jade'), // Плагин для Jade
livereload = require('gulp-livereload'), // Livereload для Gulp
imagemin = require('gulp-imagemin'), // Минификация изображений
sass = require('gulp-sass'),
connect = require('gulp-connect'),// Сервер
uncss = require('gulp-uncss'),
compass = require('gulp-compass'),
concat = require('gulp-concat'); // Склейка файлов ;
gulp.task('connect', function () {
connect.server({
root: 'public/',
livereload:true
});
});
// Собираем html из Jade
gulp.task('jade', function() {
gulp.src(['app/templates/pages/*.jade', '!app/templates/lib/_*.jade'])
.pipe(jade({
pretty: true
}))
.pipe(gulp.dest('public/')) // Записываем собранные файлы
.pipe(connect.reload()); // даем команду на перезагрузку страницы
});
/* Собираем sass
gulp.task('sass', function(){
gulp.src(['./app/styles/*.sass', '!app/styles/lib/_*.sass'])
.pipe(sass())
.pipe(gulp.dest('public/css/'))
.pipe(connect.reload());
});*/
gulp.task('compass', function() {
gulp.src(['./app/styles/*.sass', '!app/styles/lib/_*.sass'])
.pipe(compass({
config_file: './config.rb',
sass: './app/styles/',
}))
.pipe(gulp.dest('public/css/'))
.pipe(connect.reload());
});
// Собираем JS
gulp.task('js', function() {
gulp.src(['app/scripts/**/*.js', '!./app/scripts/vendor/**/*.js'])
.pipe(concat('main.js')) // Собираем все JS, кроме тех которые находятся в ./assets/js/vendor/**
.pipe(gulp.dest('public/js'))
.pipe(connect.reload()); // даем команду на перезагрузку страницы
});
// Копируем и минимизируем изображения
gulp.task('images', function() {
gulp.src('app/images/**/*')
.pipe(imagemin())
.pipe(gulp.dest('public/img'))
.pipe(connect.reload()); // даем команду на перезагрузку страницы
});
gulp.task('watch', function () {
gulp.watch('app/**/*.jade', ['jade'])
gulp.watch('app/styles/**/*.sass', ['compass'])
gulp.watch('app/images/**/*', ['images'])
gulp.watch('app/scripts/**/*.js', ['js']);
});
gulp.task('default', ['connect', 'jade', 'compass', 'js', 'images', 'watch']);
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
output_style = :compact
relative_assets = true
line_comments = false
preferred_syntax = :sass
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question