-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
44 lines (36 loc) · 1.15 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/// <binding ProjectOpened='watch' />
'use strict';
require('es6-promise').polyfill();
var gulp = require('gulp');
var sass = require('gulp-sass');
var less = require('gulp-less');
var sourcemaps = require("gulp-sourcemaps");
var autoprefixer = require('gulp-autoprefixer');
var autoprefixerOptions = {
browsers: ['last 2 versions', '> 5%', 'Firefox ESR']
};
gulp.task('sass', function () {
return gulp.src('src/sass/sass-sample.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(autoprefixer(autoprefixerOptions))
.pipe(gulp.dest('dist/css'));
});
gulp.task('less', function () {
return gulp.src('src/less/less-sample.less')
.pipe(sourcemaps.init())
.pipe(less().on('error', logError))
.pipe(sourcemaps.write())
.pipe(autoprefixer(autoprefixerOptions))
.pipe(gulp.dest('dist/css'));
});
gulp.task("watch-scss", function () {
return gulp.watch("src/scss/**/*.scss", ["sass"]);
});
gulp.task("watch-less", function () {
return gulp.watch("src/less/**/*.less", ["less"]);
});
gulp.task("default", ["sass", "less"]);
function logError(){
}