-
Notifications
You must be signed in to change notification settings - Fork 13
/
Gruntfile.js
144 lines (131 loc) · 2.98 KB
/
Gruntfile.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
'use strict';
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
const sass = require('node-sass');
// MODULES
grunt.config('clean', {
basic: [
'public/assets/build/*.css', 'public/assets/build/*.css.map',
'public/assets/build/*.js',
'public/assets/fonts/*', '!public/assets/fonts/.gitignore' // Fonts
]
});
grunt.config('sass', {
dev: {
options: {
implementation: sass,
outputStyle: 'extended',
sourceMap: true
},
files: {
'public/assets/build/app.css': 'resources/assets/sass/app.scss'
}
},
build: {
options: {
implementation: sass,
outputStyle: 'compressed'
},
files: {
'public/assets/build/app.css': 'resources/assets/sass/app.scss'
}
}
});
grunt.config('postcss', {
dev: {
options: {
map: true,
processors: [
require('autoprefixer')()
]
},
src: [
'public/assets/build/*.css'
]
},
build: {
options: {
map: false,
processors: [
require('autoprefixer')()
]
},
src: [
'public/assets/build/*.css'
]
}
});
grunt.config('concat', {
dependencies: {
src: [
'node_modules/jquery/dist/jquery.js',
'node_modules/popper.js/dist/umd/popper.js',
'node_modules/bootstrap/dist/js/bootstrap.js',
'node_modules/lightbox2/dist/js/lightbox.js'
],
dest: 'public/assets/build/dependencies.js'
},
devjs: {
src: ['resources/assets/js/app.js'],
dest: 'public/assets/build/app.js'
}
});
grunt.config('uglify', {
build: {
files: {
'public/assets/build/dependencies.min.js': ['public/assets/build/dependencies.js'],
'public/assets/build/app.min.js': ['resources/assets/js/app.js']
}
}
});
grunt.config('copy', {
fontawesome: {
expand: true,
flatten: true,
src: ['node_modules/font-awesome/fonts/*'],
dest: 'public/assets/fonts'
},
devjs: {
files: [{
cwd: 'public/assets/build/',
src: ['*.js'],
dest: 'public/assets/build/',
expand: true,
rename: function (dest, src) {
return (dest + src).replace('.js', '.min.js');
}
}]
}
});
grunt.config('watch', {
sass: {
files: 'resources/assets/sass/**/*.scss',
tasks: ['sass:dev', 'postcss:dev']
},
js: {
files: 'resources/assets/js/*.js',
tasks: ['uglify']
}
});
// TASKS
grunt.registerTask('default', 'dev');
grunt.registerTask('dev', [
'clean:basic',
'sass:dev',
'postcss:dev',
'concat:dependencies',
'concat:devjs',
'copy:fontawesome',
'copy:devjs',
'watch'
]);
grunt.registerTask('build', [
'clean:basic',
'sass:build',
'postcss:build',
'concat:dependencies',
'uglify:build',
'copy:fontawesome'
]);
};