-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (47 loc) · 2.45 KB
/
gulpfile.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
var gulp = require('gulp');
var stringReplace = require('gulp-string-replace');
var config = {
plugin: {
name: 'Wp Export Advanced Plugin', // Change plugin name
prefix: 'WpExportAdvanced', // Change plugin prefix
singleton: 'Wp_Export_Advanced', // Change plugin main class
textdomain: 'wp-export-advanced', // Change textdomain
styles: 'wp-export-advanced', // Change CSS styles prefix
author: 'SolidBunch', // Change author
plugin_uri: 'https://github.com/SolidBunch/wp-export-advanced', // Change plugin URI
author_uri: 'https://solidbunch.com', // Change author URI
}
};
// Project paths
var paths = {
toReplace: {
src: ['./**/*.php', './**/*.css', './**/*.scss', './**/*.js', '!vendor/**/*.*','!vendor-custom/**/*.*', '!node_modules/**/*.*', '!./gulpfile.js'],
},
};
gulp.task('replaceNames', function () {
return gulp.src(paths.toReplace.src)
.pipe(stringReplace('StarterKit', config.plugin.prefix))
.pipe(stringReplace('Starter_Kit', config.plugin.singleton))
// Styles, classes, ID
.pipe(stringReplace('class="starter-kit-', 'class = "' + config.plugin.styles + '-'))
.pipe(stringReplace('class = "starter-kit-', 'class = "' + config.plugin.styles + '-'))
.pipe(stringReplace('class="starter-kit_', 'class = "' + config.plugin.styles + '_'))
.pipe(stringReplace('class = "starter-kit_', 'class = "' + config.plugin.styles + '_'))
.pipe(stringReplace('#starter-kit-', '#' + config.plugin.styles + '-'))
.pipe(stringReplace('id="starter-kit-', 'id = "' + config.plugin.styles + '-'))
.pipe(stringReplace('id = "starter-kit-', 'id = "' + config.plugin.styles + '-'))
.pipe(stringReplace('\'starter-kit_', '\'' + config.plugin.styles + '_'))
.pipe(stringReplace('\\.starter-kit-', '.' + config.plugin.styles + '-'))
.pipe(stringReplace('\\.starter-kit_', '.' + config.plugin.styles + '_'))
// Textdomain
.pipe(stringReplace('Text Domain: starter-kit', 'Text Domain: ' + config.plugin.textdomain))
.pipe(stringReplace('\'starter-kit', '\'' + config.plugin.textdomain))
.pipe(stringReplace('\"starter-kit', '"' + config.plugin.textdomain))
.pipe(stringReplace('Starter Kit Plugin', config.plugin.name))
.pipe(stringReplace('SolidBunch', config.plugin.author))
.pipe(stringReplace('https://github.com/SolidBunch/starter-kit-plugin', config.plugin.plugin_uri))
.pipe(stringReplace('https://solidbunch.com', config.plugin.author_uri))
.pipe(gulp.dest(function (file) {
return file.base; // THE SAME DIR
}));
});