forked from anspress/anspress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
130 lines (125 loc) · 2.75 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
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
dirs: {
lang: 'languages',
},
makepot: {
target: {
options: {
domainPath: '/languages',
exclude: ['.git/.*', '.svn/.*', 'node_modules/.*', 'vendor/.*'],
mainFile: 'anspress-question-answer.php',
potHeaders: {
poedit: true,
'x-poedit-keywordslist': true
},
type: 'wp-plugin',
updateTimestamp: true,
updatePoFiles: true
}
}
},
csscomb: {
files: ['**/*.css', '!**/node_modules/**'],
tasks: ['csscomb'],
},
version: {
options: {
release: 'patch'
},
css: {
options: {
prefix: 'Version\\:\\s'
},
src: ['style.css'],
},
php: {
options: {
prefix: 'Version\\:\\s+'
},
src: ['anspress-question-answer.php'],
},
mainplugin: {
options: {
pattern: '\$_plugin_version = (?:\')(.+)(?:\')/g'
},
src: ['anspress-question-answer.php'],
},
project: {
src: ['package.json']
},
readme: {
options: {
prefix: 'Stable tag:\\s+'
},
src: ['readme.txt']
}
},
sass: {
dist: {
options: {
style: 'compressed',
sourcemap: 'auto'
},
files: {
"templates/css/main.css": "templates/scss/main.scss",
"templates/css/fonts.css": "templates/scss/fonts.scss",
"templates/css/RTL.css": "templates/scss/RTL.scss",
"assets/ap-admin.css": "assets/ap-admin.scss",
"templates/addons/email/style.css": "templates/addons/email/style.scss"
}
}
},
uglify: {
options: {
sourceMap: true
},
my_target: {
files: {
'assets/js/min/main.min.js': ['assets/js/common.js', 'assets/js/question.js', 'assets/js/ask.js', 'assets/js/list.js', 'assets/js/notifications.js'],
'assets/js/min/ap-admin.min.js': ['assets/js/ap-admin.js'],
'assets/js/min/admin-app.min.js': ['assets/js/admin-app.js'],
'templates/js/min/theme.min.js': ['templates/js/theme.js'],
}
}
},
wp_readme_to_markdown: {
your_target: {
files: {
'README.md': 'readme.txt'
},
},
},
compress: {
plugin: {
options: {
archive: 'build/anspress.zip'
},
files: [{
expand: true,
src: [
'**/*',
'!.',
'!build/**',
'!node_modules/**',
],
dot: false,
}, ],
},
},
watch: {
sass: {
files: ['**/*.scss'],
tasks: ['sass'],
},
uglify: {
files: ['templates/js/*.js', 'assets/js/*.js'],
tasks: ['uglify'],
}
}
});
grunt.registerTask('translate', ['makepot']);
grunt.registerTask('build', ['sass', 'uglify', 'translate']);
}