123456789101112131415161718192021222324252627282930313233343536373839404142 |
- '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', function () {
- gulp.src('./js/script.js')
- .pipe(jsmin())
- .pipe(rename({suffix: '.min'}))
- .pipe(gulp.dest('./js/'));
- });
- gulp.task('styles', function () {
- gulp.src('./scss/styles.scss')
- .pipe(sass().on('error', sass.logError))
- // .pipe(gulp.dest('./css/'));
- // gulp.src('./css/*.css')
- .pipe(autoprefixer({
- browsers: ['last 2 versions'],
- cascade: false
- })).on('error', handleError)
- .pipe(gulp.dest('./css/'));
- });
- gulp.task('default', function () {
- });
- // default gulp task
- gulp.task('default', ['scripts', 'styles'], function() {
- gulp.watch('./scss/*.scss', ['styles']);
- gulp.watch('./js/script.js', ['scripts']);
- });
|