This repository has been archived by the owner on May 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
56 lines (48 loc) · 1.6 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
45
46
47
48
49
50
51
52
53
54
55
56
/* global require */
var gulp = require("gulp");
var sass = require("gulp-sass");
var sourcemaps = require("gulp-sourcemaps");
var autoprefixer = require("gulp-autoprefixer");
var uglify = require("gulp-uglify");
var header = require("gulp-header");
var rename = require("gulp-rename");
var outputPath = "dist";
gulp.task("build:js", function () {
var pkg = require('./package.json');
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
return gulp.src("src/js/jquery.simplewizard.js")
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest(outputPath));
});
gulp.task("minify:js", ["build:js"], function () {
return gulp.src(outputPath + "/jquery.simplewizard.js")
.pipe(sourcemaps.init())
.pipe(uglify({
preserveComments: "license"
}))
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.write("/"))
.pipe(gulp.dest(outputPath));
});
gulp.task("build:sass", function () {
return gulp.src("src/scss/**/*.scss")
.pipe(sourcemaps.init())
.pipe(sass().on("error", sass.logError))
.pipe(autoprefixer({
browsers: ["> 1%", "last 4 version", "ie 9"],
cascade: false
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest(outputPath));
});
gulp.task("watch", function () {
gulp.watch("scss/**/*.scss", ["build:sass"]);
});
gulp.task("publish", ["minify:js", "build:sass"]);
gulp.task("default", ["build:js", "build:sass"]);