Commit 078d993d authored by Alexander Dubovskoy's avatar Alexander Dubovskoy

New gulpfile

parent b3781f80
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var livereload = require('gulp-livereload');
'use strict'
gulp.task('sass', function () {
gulp.src('assets/scss/callback.scss')
//.pipe(sass.sync().on('error', sass.logError))
const gulp = require("gulp");
const postcss = require('gulp-postcss');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
const sassGlob = require('gulp-sass-glob');
const plumber = require('gulp-plumber');
const lost = require('lost');
const run = require('gulp-run-command').default;
const fontawesome = require('postcss-font-awesome');
const paths = {
styles: {
// By using styles/**/*.sass we're telling gulp to check all folders for any sass file
src: "assets/scss/**/*.scss",
// Compiled files will end up in whichever folder it's found in (partials are not compiled)
dest: "assets/css",
}
}
function scss() {
return gulp
.src(paths.styles.src)
.pipe(sourcemaps.init())
.pipe(plumber())
.pipe(sassGlob())
.pipe(sass())
.pipe(postcss([lost(), fontawesome]))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('assets/css/'))
});
.pipe(sass.sync().on('error', sass.logError))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest(paths.styles.dest))
};
function watchFiles() {
scss();
gulp.watch(paths.styles.src, gulp.series('scss'));
}
gulp.task('default', function () {
livereload.listen();
gulp.start('sass');
gulp.watch('assets/scss/**', function () {
setTimeout(function () {
gulp.start('sass');
}, 200);
});
gulp.watch('assets/css/*.css').on('change', livereload.changed);
});
exports.scss = scss;
exports.watch = exports.default = watchFiles;
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,10 +10,16 @@
"author": "adubovskoy",
"license": "MIT",
"dependencies": {
"gulp": "*",
"gulp-sass": "*",
"gulp-autoprefixer": "*",
"gulp-sourcemaps": "*",
"gulp-livereload": "*"
"gulp": "^4.0.2",
"gulp-autoprefixer": "^6.1.0",
"gulp-livereload": "^4.0.1",
"gulp-plumber": "^1.2.1",
"gulp-postcss": "^8.0.0",
"gulp-run-command": "0.0.9",
"gulp-sass": "^4.0.2",
"gulp-sass-glob": "^1.0.9",
"gulp-sourcemaps": "^2.6.5",
"lost": "^8.3.1",
"postcss-font-awesome": "^0.4.0"
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment