-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
135 lines (131 loc) · 3.13 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
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
banner:
'<%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>); © <%= pkg.author %> - <%= pkg.license %>',
uglify: {
options: {
footer: "\n/*! <%= banner %> */\n",
},
build: {
files: {
"dist/js/retrotxt.js": ["js/retrotxt.js"],
"dist/js/retrotxt-init.js": ["js/retrotxt-init.js"],
"dist/js/module/charset.js": ["js/module/charset.js"],
"dist/js/module/text.js": ["js/module/text.js"],
},
},
},
copy: {
main: {
files: [
{
expand: true,
flatten: true,
src: ["font/amigafonts_v1.02/*"],
dest: "dist/font/amiga/",
},
{
expand: true,
flatten: true,
src: ["font/oldschool_pc_font_pack_v2.2/*"],
dest: "dist/font/pc/",
},
],
},
example: {
files: [
{
expand: true,
flatten: true,
src: ["example/*"],
dest: "dist/",
},
],
},
},
cssmin: {
options: {
level: 2,
},
target: {
files: [
{
src: ["css/retrotxt.css"],
dest: "dist/css/retrotxt.css",
},
],
},
},
usebanner: {
taskName: {
options: {
position: "bottom",
banner:
"/*! <%= banner %>\n VGA 8x16 fonts © VileR; TopazPlus fonts © dMG/t!s^dS! */\n",
linebreak: true,
},
files: {
src: ["dist/css/retrotxt.css"],
},
},
},
eslint: {
options: {
overrideConfigFile: "eslint.config.mjs",
},
target: ["js/**.js", "js/module/**.js"],
},
stylelint: {
options: {
fix: true,
},
src: ["css/**/*.css"],
},
// Due to CORS and the use of modules, tests must be run on a live server.
qunit: {
all: {
options: {
urls: ["http://localhost:8001/test/test.html"],
},
},
},
connect: {
server: {
options: {
port: 8001,
base: ".",
},
},
},
clean: {
build: {
src: ["dist"],
},
},
});
// Load the plugin that provides the tasks.
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-eslint");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-contrib-qunit");
grunt.loadNpmTasks("grunt-stylelint");
grunt.loadNpmTasks("grunt-banner");
grunt.loadNpmTasks("grunt-contrib-clean");
// Default task(s).
grunt.registerTask("default", [
"clean",
"uglify",
"copy:main",
"copy:example",
"cssmin",
"usebanner",
]);
// Lint source code.
grunt.registerTask("lint", ["eslint", "stylelint"]);
// JS unit tests.
grunt.registerTask("test", ["connect:server", "qunit"]);
};