1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- 'use strict';
- var gulp = require('gulp');
- var sass = require('gulp-sass');
- var watch = require('gulp-watch');
- var autoprefixer = require('gulp-autoprefixer');
- var cleancss = require('gulp-clean-css');
- var jsmin = require('gulp-jsmin');
- var rename = require('gulp-rename');
- gulp.task('scripts', function () {
- gulp.src('./js/*.js')
- .pipe(jsmin())
- .pipe(rename({suffix: '.min'}))
- .pipe(gulp.dest('./js/dist/'));
- });
- gulp.task('scss', function () {
- gulp.src('./scss/*.scss')
- .pipe(sass().on('error', sass.logError))
- .pipe(gulp.dest('./css'));
- });
- gulp.task('css', function () {
- gulp.src('./css/*.css')
- //autoprefixer
- .pipe(autoprefixer({
- browsers: ['last 2 versions'],
- cascade: false
- }))
- .pipe(gulp.dest('./css'))
- // cleancss
- .pipe(cleancss())
- .pipe(rename({ suffix: '.min' }))
- .pipe(gulp.dest('./css/dist'));
- });
- // default gulp task
- gulp.task('default', ['scripts', 'scss', 'css'], function() {
- gulp.watch('./scss/**/*.scss', ['scss']);
- gulp.watch('./css/**/*.css', ['css']);
- gulp.watch('./js/**/*.js', ['scripts']);
- });
|