forked from mladenplavsic/masongram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (42 loc) · 1.14 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var less = require('gulp-less');
var rename = require('gulp-rename');
var cssnano = require('gulp-cssnano');
var uglify = require('gulp-uglify');
var iife = require('gulp-iife');
var replace = require('gulp-replace');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('default', [
'docs'
]);
gulp.task('js', function () {
return gulp.src('src/js/*.js')
.pipe(sourcemaps.init())
.pipe(concat('masongram.min.js'))
.pipe(replace(/["']use strict["'];/g, ''))
.pipe(iife({
params: ['window', 'document', '$'],
args: ['window', 'document', 'jQuery']
}))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'))
});
gulp.task('less', function () {
return gulp.src('./src/less/*.less')
.pipe(less())
.pipe(cssnano())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist'));
});
gulp.task('docs', ['js', 'less'], function () {
return gulp.src([
'./dist/*.min.*',
'./dist/*.min.*.map'
])
.pipe(gulp.dest('docs'))
});
gulp.task('watch', ['docs'], function () {
gulp.watch('src/**/*.*', ['docs']);
});