-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.cjs
50 lines (48 loc) · 2.07 KB
/
gruntfile.cjs
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
// https://stackoverflow.com/questions/17008472/how-to-minify-multiple-javascript-files-in-a-folder-with-uglifyjs
// https://stackoverflow.com/questions/18997852/grunt-js-uglify-is-appending-uglified-code-to-file-instead-of-rewriting-it
https: module.exports = function (grunt) {
grunt.initConfig({
uglify: {
files: {
options: {
force: true,
},
src: ['src/public/scripts/**/*.js', '!src/public/scripts/**/*.min.js'],
dest: 'src/public/scripts/',
expand: true,
flatten: true,
ext: '.min.js',
},
},
watch: {
options: {
livereload: true,
nospawn: true,
},
js: { files: 'src/public/scripts/*.js', tasks: ['uglify'] },
},
copy: {
main: {
files: [
{ expand: true, cwd: 'src', src: ['**/public/robots.txt'], dest: 'build', filter: 'isFile' },
{ expand: true, cwd: 'src', src: ['**/tools/plugins/do_not_delete.txt'], dest: 'build', filter: 'isFile' },
{ expand: true, cwd: 'src', src: ['**/public/uploads/do_not_delete.txt'], dest: 'build', filter: 'isFile' },
{ expand: true, cwd: 'src', src: ['**/public/styles/*.css'], dest: 'build', filter: 'isFile' },
{ expand: true, cwd: 'src', src: ['**/public/scripts/*.min.js'], dest: 'build', filter: 'isFile' },
{ expand: true, cwd: 'src', src: ['**/public/img/**'], dest: 'build' },
{ expand: true, cwd: 'src', src: ['**/public/dist/**'], dest: 'build' },
{ expand: true, cwd: 'src', src: ['**/public/plugins/**'], dest: 'build' },
{ expand: true, cwd: 'src', src: ['**/admin/**'], dest: 'build' },
{ expand: true, cwd: 'src', src: ['**/tools/themes/**'], dest: 'build' },
{ expand: true, cwd: 'src', src: ['**/views/themeConfig/**'], dest: 'build' },
],
},
},
});
// load plugins
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
// register at least this one task
grunt.registerTask('default', ['uglify']);
};