-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
125 lines (109 loc) · 5.65 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
/* jshint esversion: 6 */
/// <binding BeforeBuild='default' />
module.exports = function (grunt) {
const sass = require('sass');
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
debug: {
src: ["dist/*"]
},
release: {
src: ["dist/*", "Publish"]
}
},
sass: {
options: {
implementation: sass,
sourceMap: false, // Create source map
outputStyle: 'expanded' // Minify output
},
dist: {
files: [{
expand: true, // Recursive
cwd: "src/content/sass", // The startup directory
src: ["*.scss"], // Source files
dest: "dist/content/css", // Destination
ext: ".css", // File extension
}]
}
},
copy: {
release: {
files: [
// js
{ expand: true, flatten: true, src: 'node_modules/@fortawesome/fontawesome-free/js/all.min.js', dest: 'dist/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js', dest: 'dist/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map', dest: 'dist/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/js/bootstrap4-toggle.min.js', dest: 'dist/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap-slider/dist/bootstrap-slider.min.js', dest: 'dist/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/jquery/dist/jquery.min.js', dest: 'dist/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/paginationjs/dist/pagination.js', dest: 'dist/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js', dest: 'dist/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js.map', dest: 'dist/content/js', filter: 'isFile' },
{ expand: true, flatten: false, cwd: "src", src: '**/*.js', dest: 'dist', filter: 'isFile' },
// css
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/css/bootstrap.min.css', dest: 'dist/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/css/bootstrap.min.css.map', dest: 'dist/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css', dest: 'dist/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css.map', dest: 'dist/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap-slider/dist/css/bootstrap-slider.min.css', dest: 'dist/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/paginationjs/dist/pagination.css', dest: 'dist/content/css', filter: 'isFile' },
{ expand: true, flatten: false, cwd: "src", src: '**/*.css', dest: 'dist', filter: 'isFile' },
// content
{ expand: true, flatten: true, src: 'src/*.html', dest: 'dist', filter: 'isFile' },
{ expand: true, flatten: true, src: 'src/manifest.json', dest: 'dist', filter: 'isFile' },
// images
{ expand: true, flatten: false, cwd: "src/content/assets/images/", src: '**', dest: 'dist/content/assets/images' },
]
},
debug: {
files: [
// debug
{ expand: true, flatten: false, cwd: "src", src: '**/*.js', dest: 'dist', filter: 'isFile' },
]
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: ['Gruntfile.js', 'src/content/**/*.js']
},
watch: {
debug: {
files: [
'Gruntfile.js',
'src/**/*.*'
],
tasks: ['release'],
options: {
spawn: false,
},
}
},
shell: {
ps: {
options: {
stdout: true
},
command: 'powershell.exe -File CreatePackage_Grunt.ps1'
},
sh: {
options: {
stdout: true
},
command: 'create-package_Grunt.sh'
}
}
});
// debug group task
grunt.registerTask('debug', ['jshint', 'clean:debug', 'copy']);
// release group task
grunt.registerTask('release', ['jshint', 'clean:release', 'sass', 'copy:release', 'shell:ps']);
// Runs the .sh package create. Possibly.
// grunt.registerTask('release', ['jshint', 'clean:release', 'sass', 'copy:release', 'shell:sh']);
// review group task
grunt.registerTask('review', ['clean:release', 'copy:release']);
};