mirror of https://github.com/ThmmyNoLife/mTHMMY
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
54 lines
1.2 KiB
var gulp = require('gulp');
|
|
var sass = require('gulp-sass');
|
|
var cleanCSS = require('gulp-clean-css');
|
|
var rename = require("gulp-rename");
|
|
var autoprefixer = require('gulp-autoprefixer');
|
|
var browserSync = require('browser-sync').create();
|
|
|
|
// Compile SCSS
|
|
gulp.task('css:compile', function() {
|
|
return gulp.src('./scss/**/*.scss')
|
|
.pipe(sass.sync({
|
|
outputStyle: 'expanded'
|
|
}).on('error', sass.logError))
|
|
.pipe(autoprefixer({
|
|
browsers: ['last 2 versions'],
|
|
cascade: false
|
|
}))
|
|
.pipe(gulp.dest('./css'))
|
|
});
|
|
|
|
// Minify CSS
|
|
gulp.task('css:minify', ['css:compile'], function() {
|
|
return gulp.src([
|
|
'./css/*.css',
|
|
'!./css/*.min.css'
|
|
])
|
|
.pipe(cleanCSS())
|
|
.pipe(rename({
|
|
suffix: '.min'
|
|
}))
|
|
.pipe(gulp.dest('./css'))
|
|
.pipe(browserSync.stream());
|
|
});
|
|
|
|
// CSS
|
|
gulp.task('css', ['css:compile', 'css:minify']);
|
|
|
|
// Default task
|
|
gulp.task('default', ['css']);
|
|
|
|
// Configure the browserSync task
|
|
gulp.task('browserSync', function() {
|
|
browserSync.init({
|
|
server: {
|
|
baseDir: "./"
|
|
}
|
|
});
|
|
});
|
|
|
|
// Dev task
|
|
gulp.task('dev', ['css', 'browserSync'], function() {
|
|
gulp.watch('./scss/*.scss', ['css']);
|
|
gulp.watch('./*.html', browserSync.reload);
|
|
});
|
|
|