This repository has been archived by the owner on Apr 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gulpfile.js
56 lines (50 loc) · 1.63 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
var gulp = require('gulp'),
stylus = require('gulp-stylus'),
poststylus = require('poststylus'),
uglify = require('gulp-uglify'),
browserify = require('browserify'),
sourcemaps = require('gulp-sourcemaps'),
rupture = require('rupture'),
babelify = require('babelify'),
bootstrap = require('bootstrap-styl'),
source = require('vinyl-source-stream'),
streamify = require('gulp-streamify'),
nano = require('gulp-cssnano');
var paths = {
cssSource: 'resources/styl/',
destination: 'assets/',
jsSource: 'resources/js/'
};
gulp.task('styles', function () {
return gulp.src(paths.cssSource + 'main.styl')
.pipe(sourcemaps.init())
.pipe(stylus({
use: [
rupture(),
bootstrap(),
poststylus(['postcss-normalize', 'lost', 'autoprefixer'])
]
}))
.on('error', function (err) {
console.log(err);
this.emit('end');
})
.pipe(nano({autoprefixer: false}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.destination));
});
gulp.task('scripts', function () {
return browserify(paths.jsSource + 'app.js')
.transform(babelify, {presets: ["es2015"]})
.bundle()
.on('error', function (e) {
console.log(e.message);
this.emit('end');
})
.pipe(source('app.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest(paths.destination));
});
gulp.watch(paths.cssSource + '**/*.styl', ['styles']);
gulp.watch(paths.jsSource + '**/*.js', ['scripts']);
gulp.task('default', ['styles', 'scripts']);