Answer the question
In order to leave comments, you need to log in
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
http_path = "/"
css_dir = "css"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "js"
output_style = :expanded
relative_assets = true
line_comments = true
'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'
]);
Error: You need to have Ruby and Compass installed and in your system PATH for this task to
work.
Answer the question
In order to leave comments, you need to log in
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
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}));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question