forked from openSUSE/landing-page
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
73 lines (63 loc) · 2.33 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
// Include gulp
var gulp = require('gulp');
// Define main directories
var assets = 'assets/';
var destination = 'build/';
// Concatenate & Minify JS
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var stripDebug = require('gulp-strip-debug');
gulp.task('scripts', function() {
return gulp.src([assets + 'js/vendor/jquery.min.js',
assets + 'js/vendor/bootstrap.min.js',
assets + 'js/vendor/jquery.easing.1.3.js',
assets + 'js/vendor/smoothscroll.js',
assets + 'js/vendor/owl.carousel.min.js',
assets + 'js/vendor/wow.js',
assets + 'js/vendor/Modernizr.custom.js',
assets + 'js/vendor/jquery-cookie.js',
assets + 'js/vendor/jquery-lang.js',
assets + 'js/opensuse-news.js',
assets + 'js/opensuse-theme.js'])
.pipe(concat('main.js'))
.pipe(rename({suffix: '.min'}))
.pipe(stripDebug())
.pipe(uglify())
.pipe(gulp.dest(destination + 'js'));
});
// Preprocess CSS
var less = require('gulp-less');
var path = require('path');
gulp.task('less', function () {
return gulp.src(assets + 'css/openSUSE.less')
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(destination + 'css'));
});
gulp.task('vendorCSS', ['less'], function() {
return gulp.src([assets + 'css/vendor/animate/animate.css',
assets + 'css/vendor/owl-carousel/owl.carousel.css',
assets + 'css/vendor/fontawesome/font-awesome.css'])
.pipe(concat('vendor.css'))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(destination + 'css'))
});
// Watch for changes in our custom assets
gulp.task('watch', function() {
// Watch .js files
gulp.watch(assets + 'js/*.js', ['customeScripts']);
gulp.watch(assets + 'js/vendor/*.js', ['customeScripts']);
// Watch .scss files
gulp.watch(assets + 'css/*.less', ['less']);
});
// Run python server on localhost:8000
var serverCommand = 'python -m SimpleHTTPServer';
var shell = require('gulp-shell');
gulp.task('runServer', shell.task([
serverCommand
]))
// Default Task
gulp.task('default', ['scripts', 'less', 'vendorCSS', 'watch', 'runServer']);