forked from ellmetha/django-machina
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
84 lines (69 loc) · 2.31 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
74
75
76
77
78
79
80
81
82
83
84
/* Gulp packages */
'use strict';
/* Include Gulp & Tools we'll use */
var gulp = require('gulp'),
path = require('path'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
less = require('gulp-less'),
minifyCSS = require('gulp-minify-css');
/* Global variables */
var application_name = 'machina';
/* DIRS */
var static_dir = 'machina/static/machina';
var build_dir = static_dir + '/build';
var bower_dir = static_dir + '/_libs';
var less_dir = static_dir + '/less';
var js_dir = static_dir + '/js';
/* Include all needed javascript packages here. */
var packages_includes = [
bower_dir + '/jquery/dist/jquery.js',
bower_dir + '/bootstrap/dist/js/bootstrap.js',
];
/* Include all application related files here. */
var application_includes = [
js_dir + '/**/*.js',
];
/* Include all of the project styling here. */
var style_includes = [
less_dir + '/admin_theme.less',
less_dir + '/board_theme.less',
];
/* Include all of the project fonts here. */
var font_includes = [
bower_dir + '/bootstrap/dist/fonts/*',
bower_dir + '/font-awesome/fonts/*',
];
/* Task to build our javascript packages. */
gulp.task('build-js-packages', function () {
gulp.src(packages_includes)
.pipe(concat(application_name + '.packages.js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest(build_dir + '/js'))
});
/* Task to build our javascript application. */
gulp.task('build-js-application', function () {
gulp.src(application_includes)
.pipe(concat(application_name + '.js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest(build_dir + '/js'))
});
/* Task to build our application style. */
gulp.task('build-css', function () {
gulp.src(style_includes)
.pipe(less())
.pipe(rename({prefix: application_name + '.', suffix: '.min'}))
.pipe(minifyCSS())
.pipe(gulp.dest(build_dir + '/css'));
});
/* Task to copy our application fonts. */
gulp.task('build-font', function () {
gulp.src(font_includes).pipe(gulp.dest(build_dir + '/fonts'));
});
/* Task to build our application. */
gulp.task('build-application', ['build-js-packages', 'build-js-application', 'build-css', 'build-font']);
/* Default task. */
gulp.task('default', ['build-application', ]);