forked from anspress/anspress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
145 lines (138 loc) · 3.01 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
136
137
138
139
140
141
142
143
144
145
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
}
}
},
potomo: {
dist: {
options: {
poDel: false
},
files: [{
expand: true,
cwd: '<%= dirs.lang %>',
src: ['*.po'],
dest: '<%= dirs.lang %>',
ext: '.mo',
nonull: 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']
}
},
sass: {
dist: {
options: {
style: 'compressed',
sourcemap: 'file'
},
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"
}
}
},
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/min/ap-admin.min.js': ['assets/js/ap-admin.js'],
'assets/js/min/admin-app.min.js': ['assets/js/admin-app.js'],
'assets/js/min/tags.min.js': ['assets/js/tags.js'],
'assets/js/min/notifications.min.js': ['assets/js/notifications.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('precommit', function () {
grunt.task.run('build');
});
grunt.registerTask('translate', ['makepot', 'potomo']);
grunt.registerTask('build', ['sass', 'uglify', 'translate']);
}