-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathgulpfile.js
More file actions
51 lines (43 loc) · 1.12 KB
/
gulpfile.js
File metadata and controls
51 lines (43 loc) · 1.12 KB
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
'use strict';
const path = require('path');
const gulp = require('gulp');
const concat = require('gulp-concat');
const less = require('gulp-less');
const uglify = require('gulp-uglify');
const minifyCSS = require('gulp-clean-css');
const del = require('del');
const shell = require('gulp-shell');
/**
* Production css file
* @type {String}
*/
const CSS_DIST = 'main.min.css';
/**
* Production js file
* @type {String}
*/
const JS_DIST = 'main.min.js';
/**
* Production folder
* @type {String}
*/
const DIST_FOLDER = './dist/';
// Concat js files and uglify/minify them
gulp.task('scripts', function() {
gulp.src(['./js/**/*.js'])
.pipe(concat(JS_DIST))
.pipe(uglify({mangle: false}))
.pipe(gulp.dest(DIST_FOLDER));
});
// Remove all js files from the production folder
gulp.task('clean-js', function() {
del([`${DIST_FOLDER}*.js`, ]).then(paths => {
paths.length && console.log('Removed:\n', paths.join('\n'));
});
});
// Remove all css files from the production folder
gulp.task('clean-css', function() {
// Your code here
});
gulp.task('build', ['clean-js', 'scripts']);
gulp.task('deploy', ['build']);