-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
74 lines (63 loc) · 2.01 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"use strict";
const gulp = require('gulp');
const jshint = require('gulp-jshint');
const sass = require('gulp-sass');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const nodemon = require('gulp-nodemon');
const minify = require('gulp-minify-css');
var replace = require('gulp-replace');
/* Code Inspection Task */
gulp.task('lint', () => {
return gulp.src('resources/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
/* SASS compile Task */
gulp.task('core-sass', () => {
return gulp.src('resources/scss/*.scss')
.pipe(sass())
.pipe(minify())
.pipe(gulp.dest('statics/dist'));
});
gulp.task('partial-sass', () => {
return gulp.src('resources/scss/partials/*.scss')
.pipe(sass())
.pipe(minify())
.pipe(gulp.dest('statics/dist'));
});
/* JS minify Task */
gulp.task('scripts', () => {
return gulp.src('resources/js/*.js')
.pipe(gulp.dest('statics/dist'))
.pipe(uglify())
.pipe(gulp.dest('statics/dist'));
});
gulp.task('assets', ()=> {
return gulp.src('resources/assets/*.*')
.pipe(gulp.dest('statics/dist'));
});
/* Target File watcher Task */
gulp.task('watch', () => {
gulp.watch('resources/js/*.js', ['lint', 'scripts']);
gulp.watch('resources/scss/*.scss', ['core-sass']);
gulp.watch('resources/scss/partials/*.scss', ['partial-sass']);
gulp.watch('resources/assets/*.*', ['assets']);
});
/* Save and Refresh via Node Monitor */
gulp.task('saveRefresh', function () {
nodemon(
{
script: 'index.js',
ext: 'js css',
tasks: ['lint']
})
.on('restart', function () {
console.log('restarted pos web server');
});
});
// Developer run Task
gulp.task('default', ['lint', 'core-sass', 'partial-sass', 'scripts', 'assets', 'watch', 'saveRefresh']);
// Prod Build Task
gulp.task('build', ['lint', 'core-sass', 'partial-sass', 'scripts', 'assets']);