var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
notify = require("gulp-notify"),
bower = require('gulp-bower');
var config = {
sassPath: './resources/sass',
bowerDir: './bower_components'
};
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest(config.bowerDir))
});
gulp.task('icons', function() {
return gulp.src(config.bowerDir + '/font-awesome/fonts/**.*')
.pipe(gulp.dest('./public/fonts'));
});
gulp.task('css', function() {
return gulp.src(config.sassPath + '/style.scss')
.pipe(sass({
style: 'compressed',
loadPath: [
'./resources/sass',
config.bowerDir + '/bootstrap-sass-official/assets/stylesheets',
config.bowerDir + '/font-awesome/scss',
]
})
.on("error", notify.onError(function (error) {
return "Error: " + error.message;
})))
.pipe(gulp.dest('./public/css'));
});
gulp.task('watch', function() {
gulp.watch(config.sassPath + '/**/*.scss', ['css']);
});
gulp.task('default', ['bower', 'icons', 'css']);
'use strict';
/*
npm install --save-dev \
gulp \
node-sass \
gulp-sass \
compass-mixins \
bootstrap-sass \
gulp-autoprefixer \
gulp-minify-css \
gulp-sourcemaps
*/
// load plugins
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minify_css = require('gulp-minify-css'),
sourcemaps = require('gulp-sourcemaps'),
path = require('path');
gulp.task('sass', function () {
gulp.src("paths/to/sass/files/**/*.sass")
.pipe(sourcemaps.init())
.pipe(
sass({
includePaths: [],
imagePath: "path/to/images"
})
.on('error', sass.logError))
// https://github.com/ai/browserslist
.pipe(autoprefixer("last 2 version", "> 1%", "Explorer >= 8", {
cascade: true
}))
.pipe(minify_css({compatibility: 'ie8'}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest("paths/to/css_dir"));
});
//watch
gulp.task('live', function () {
//watch .sass files
gulp.watch("paths/to/sass/files/**/*.sass", ['sass']);
});
gulp.task('default', ['live']);
gulp.task('css', function() {
return sass(config.sassPath + '/style.scss', {
style: 'compressed',
loadPath: [
'./resources/sass',
config.bowerDir + '/bootstrap-sass/assets/stylesheets',
config.bowerDir + '/font-awesome/scss',
]
})
.on("error", notify.onError(function (error) {
return "Error: " + error.message;
}))
.pipe(gulp.dest('./public/css'));
});