forked from irishquinn/feedback
-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
57 lines (51 loc) · 1.64 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
/**
* Created by jandres on 28/01/16.
*/
var path = require('path'),
gulp = require('gulp'),
less = require('gulp-less'),
rename = require("gulp-rename"),
minifyCSS = require('gulp-minify-css'),
browserify = require('gulp-browserify'),
uglify = require('gulp-uglify'),
rename = require("gulp-rename"),
babel = require("gulp-babel"),
stringify = require('stringify');
var paths = {
js: ['./src/**/*.js'],
less: ['./style/**/*.less'],
templates: ['./templates/**/*.html']
};
// LESS/CSS section.
gulp.task('css', function () {
gulp.src('./style/feedback.less')
.pipe(less({
paths: [path.join(__dirname, 'styles', 'includes')]
}))
.pipe(gulp.dest('./dist'))
.pipe(minifyCSS({keepBreaks: false}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist'));
// Copy images in styles directory that the stylesheets will probably need.
gulp.src('./style/*.{ttf,woff,eof,svg,png,jpg,jpeg}')
.pipe(gulp.dest('./dist'));
});
// JS section.
gulp.task('js', function() {
gulp.src('./src/feedback.js')
.pipe(browserify({
transform: stringify({ extensions: ['.html'], minify: true })
}))
.pipe(babel())
.pipe(gulp.dest('./dist'))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist'));
});
// Watcher section.
gulp.task('watchers', function () {
gulp.watch(paths.less, ['css']);
gulp.watch(paths.js, ['js']);
gulp.watch(paths.templates, ['js']);
});
gulp.task('default', ['css', 'js', 'watchers']);