1234567891011121314151617181920212223242526272829303132333435363738394041 |
- 'use strict';
- var gulp = require('gulp');
- var sass = require('gulp-sass');
- var watch = require('gulp-watch');
- var autoprefixer = require('gulp-autoprefixer');
- var jsmin = require('gulp-jsmin');
- var rename = require('gulp-rename');
- function handleError(err) {
- console.log(err.toString());
- // this.emit('end');
- }
- gulp.task('scripts', done => {
- gulp.src('./js/script.js')
- .pipe(jsmin())
- .pipe(rename({suffix: '.min'}))
- .pipe(gulp.dest('./js/'));
- done();
- });
- gulp.task('styles', done => {
- gulp.src('./scss/styles.scss')
- .pipe(sass().on('error', sass.logError))
- // .pipe(gulp.dest('./css/'));
- // gulp.src('./css/*.css')
- .pipe(autoprefixer({
- cascade: false
- })).on('error', handleError)
- .pipe(gulp.dest('./css/'));
- done();
- });
- // default gulp task
- gulp.task('default', gulp.series('scripts', 'styles', function(done) {
- gulp.watch('./scss/*.scss', gulp.series('styles'));
- gulp.watch('./js/script.js', gulp.series('scripts'));
- done()
- }));
|