-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
102 lines (88 loc) · 2.19 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
module.exports = function ( grunt ) {
const sass = require( 'node-sass' );
require( 'load-grunt-tasks' )( grunt );
grunt.initConfig( {
sass: {
options: {
implementation: sass,
outputStyle: 'compressed',
sourceMap: false
},
dist: {
files: [ {
expand: true,
cwd: 'assets/css/scss',
src: [ '*.scss' ],
dest: 'assets/css',
ext: '.css'
} ]
}
},
uglify: {
options: { mangle: false },
main: {
files: [ {
expand: true,
cwd: 'assets/js',
src: [ '**/*.js', '!**/*.min.js' ],
dest: 'assets/js',
ext: '.min.js'
} ]
}
},
watch: {
main: {
files: [ 'assets/js/*.js', '!assets/js/*.min.js', 'readme.txt' ],
tasks: [ 'uglify:main' ]
},
scss: {
files: [ 'assets/css/scss/*.scss' ],
tasks: [ 'sass:dist' ]
}
},
// Add text domain to all strings, and modify existing text domains in included packages.
addtextdomain: {
options: {
textdomain: 'gravityview-az-filters', // Project text domain.
updateDomains: [ 'gravityview' ] // List of text domains to replace.
},
target: {
files: {
src: [
'*.php',
'**/*.php',
'!node_modules/**',
'!tests/**',
'!tmp/**',
'!vendor/**'
]
}
}
},
exec: {
// Generate POT file.
makepot: {
cmd: function () {
var fileComments = [
'Copyright (C) ' + new Date().getFullYear() + ' GravityKit',
'This file is distributed under the GPLv2 or later',
];
var headers = {
'Last-Translator': 'GravityKit <[email protected]>',
'Language-Team': 'GravityKit <[email protected]>',
'Language': 'en_US',
'Plural-Forms': 'nplurals=2; plural=(n != 1);',
'Report-Msgid-Bugs-To': 'https://www.gravitykit.com/support',
};
var command = 'wp i18n make-pot --exclude=build . translations.pot';
command += ' --file-comment="' + fileComments.join( '\n' ) + '"';
command += ' --headers=\'' + JSON.stringify( headers ) + '\'';
return command;
}
},
}
} );
grunt.registerTask( 'default', [ 'sass', 'uglify' ] );
// Translation stuff.
grunt.registerTask( 'translate', [ 'addtextdomain', 'exec:makepot' ] );
};