-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.cjs
52 lines (49 loc) · 1.19 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
51
52
const fs = require("fs")
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd HH:MM") %> */\n'
},
build: {
src: [
'src/config_parser.js', 'src/constants.js', 'src/token.js', 'src/error.js',
'src/reverse_web.js', 'src/parser/*.js'
],
dest: 'bundle/hbml_browser.min.js'
}
},
"regex-replace": {
default: {
src: ['bundle/hbml_browser.min.js'],
actions: [
{
name: "imports1",
search: 'import [^ ]+ from"[^"]+";',
replace: '',
flags: 'g'
},
{
name: "imports2",
search: 'import\{[^}]+}from"[^"]+";',
replace: '',
flags: 'g'
},
{
name: "exports",
search: 'export\{[^}]+};',
replace: 'export\{fullStringify,snippet,full\};',
flags: 'g'
}
]
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-regex-replace');
// Default task(s).
grunt.registerTask('default', ['uglify', 'regex-replace']);
};