forked from boonebgorges/buddypress-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
127 lines (115 loc) · 3.3 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
'use strict';
module.exports = function(grunt) {
// load all grunt tasks matching the `grunt-*` pattern
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Watch for changes and trigger less, jshint, uglify and livereload
watch: {
options: {
livereload: true
},
scripts: {
files: ['public/js/src/*.js'],
tasks: ['jshint', 'uglify']
},
styles: {
files: ['includes/scss/*.scss'],
tasks: ['sass', 'postcss']
}
},
sass: {
options: {
sourceMap: true
},
dist: {
files: [{
// Set to true for recursive search
expand: true,
cwd: 'includes/scss/',
src: ['screen.scss', 'folders.scss'],
dest: 'includes/css/',
ext: '.css'
}]
}
},
// Generate RTL stylesheet.
rtlcss: {
basic: {
options: {
opts: {
processUrls: false,
autoRename: false,
clean: false
},
saveUnmodified: true
},
expand: true,
ext: '-rtl.css',
cwd: 'includes/css/',
src: ['**/*.css'],
dest: 'includes/css-rtl/'
}
},
// PostCSS handles post-processing on CSS files. Used here to autoprefix and minify.
postcss: {
options: {
processors: [
require('autoprefixer')(),
require('cssnano')()
]
},
dist: {
src: [
'includes/css/*.css',
// 'admin/css/*.css'
]
}
},
// JavaScript linting with jshint
jshint: {
all: [
// 'public/js/src/*.js'
]
},
// Uglify to concat, minify, and make source maps
uglify: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
common: {
files: {
// 'public/js/public.min.js': ['public/js/src/*.js']
}
}
},
// Create language translation source files.
makepot: {
target: {
options: {
cwd: '.', // Directory of files to internationalize.
domainPath: '.', // Where to save the POT file.
exclude: [], // List of files or directories to ignore.
include: [], // List of files or directories to include.
mainFile: 'loader.php',
potComments: '', // The copyright at the beginning of the POT file.
potFilename: 'languages/buddypress-docs.pot', // Name of the POT file.
potHeaders: {
poedit: true, // Includes common Poedit headers.
'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
}, // Headers to add to the generated POT file.
processPot: null, // A callback function for manipulating the POT file.
type: 'wp-plugin', // Type of project (wp-plugin or wp-theme).
updateTimestamp: true, // Whether the POT-Creation-Date should be updated without other changes.
updatePoFiles: false // Whether to update PO files in the same directory as the POT file.
}
}
}
});
// Register tasks
// Typical run, cleans up css and js, starts a watch task.
grunt.registerTask('default', ['sass', 'postcss', 'watch']);
// Before releasing a build, also create the RTL CSS stylesheet and the language file.
grunt.registerTask('release', ['sass', 'postcss', 'rtlcss', 'makepot']);
};