forked from xsynaptic/wordpress-gulp-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpconfig.js
133 lines (122 loc) · 4.65 KB
/
gulpconfig.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
// ==== CONFIGURATION ==== //
// Project paths
var project = 'BBTheme'
, src = './src/'
, build = './build/'
, dist = './dist/'+project+'/'
, bower = './bower_components/'
, vendor = './src/vendor/'
;
// Project settings
module.exports = {
bower: {
normalize: { // Copies `normalize.css` from `bower_components` to `src/scss` and renames it to allow for it to imported as a Sass file
src: bower+'normalize.css/normalize.css'
, dest: src+'scss'
, rename: '_normalize.scss'
}
},
browsersync: {
files: [build+'/**', '!'+build+'/**.map'] // Exclude map files
, notify: false // In-line notifications (the blocks of text saying whether you are connected to the BrowserSync server or not)
, open: true // Set to false if you don't like the browser window opening automatically
, port: 3000 // Port number for the live version of the site; default: 3000
, proxy: 'elowp.dev' // Using a proxy instead of the built-in server as we have server-side rendering to do via WordPress
, watchOptions: {
debounceDelay: 2000 // Delay for events called in succession for the same file/event
}
},
images: {
build: { // Copies images from `src` to `build`; does not optimize
src: src+'**/*(*.png|*.jpg|*.jpeg|*.gif)'
, dest: build
}
, dist: {
src: [dist+'**/*(*.png|*.jpg|*.jpeg|*.gif)', '!'+dist+'screenshot.png']
, imagemin: {
optimizationLevel: 7
, progressive: true
, interlaced: true
}
, dest: dist
}
},
livereload: {
port: 35729
},
scripts: {
bundles: { // Bundles are defined by a name and an array of chunks to concatenate; warning: it's up to you to manage dependencies!
core: ['core']
, pg8: ['pg8', 'core']
}
, chunks: { // Chunks are arrays of globs matching source files that combine to provide specific functionality
core: [src+'js/responsive-menu.js', src+'js/core.js']
, pg8: [vendor+'jquery/dist/jquery.min.js', vendor+'bootstrap-sass-official/assets/javascripts/bootstrap.min.js']
}
, dest: build+'js/' // Where the scripts end up
, lint: {
src: [src+'js/**/*.js'] // Lint core scripts (for everything else we're relying on the original authors)
}
, minify: {
src: [build+'js/**/*.js', '!'+build+'js/**/*.min.js'] // Avoid recursive min.min.min.js
, rename: { suffix: '.min' }
, uglify: {}
, dest: build+'js/'
}
, namespace: 'wp-' // Script filenames will be prefaced with this (optional; leave blank if you have no need for it but be sure to change the corresponding value in `src/inc/assets.php`)
},
styles: {
build: {
src: [src+'scss/*.scss', '!'+src+'scss/_*.scss'] // Ignore partials
, dest: build
}
, dist: {
src: [dist+'**/*.css', '!'+dist+'**/*.min.css']
, dest: dist
}
, compiler: 'libsass' // Choose a Sass compiler: 'libsass' or 'ruby-sass'
, autoprefixer: { browsers: ['> 3%', 'last 2 versions', 'ie 9', 'ios 6', 'android 4'] }
, rename: { suffix: '.min' }
, minify: { keepSpecialComments: 1, roundingPrecision: 3 }
, rubySass: { // Requires the Ruby implementation of Sass; run `gem install sass` if you use this; Compass is not included by default
loadPath: bower // Adds the `bower_components` directory to the load path so you can @import directly
, precision: 6
, 'sourcemap=none': true // Not yet ready for prime time; Sass 3.4 has srcmaps on by default but this causes some problems in the Gulp toolchain
}
, libsass: { // Requires the libsass implementation of Sass
includePaths: [bower] // Adds the `bower_components` directory to the load path so you can @import directly
, precision: 6
, onError: function(err) {
return console.log(err);
}
}
},
theme: {
lang: {
src: src+'languages/**/*' // Glob matching any language files you'd like to copy over
, dest: build+'languages/'
}
, php: {
src: src+'**/*.php'
, dest: build
}
},
utils: {
clean: [build+'**/.DS_Store'] // A glob matching junk files to clean out of `build`
, wipe: [dist] // Clean this out before creating a new distribution copy
, dist: {
src: [build+'**/*', '!'+build+'**/*.min.css*']
, dest: dist
}
},
watch: { // What to watch before triggering each specified task
src: {
styles: src+'scss/**/*.scss'
, scripts: [src+'js/**/*.js', bower+'**/*.js']
, images: src+'**/*(*.png|*.jpg|*.jpeg|*.gif)'
, theme: src+'**/*.php'
, livereload: [build+'**/*']
}
, watcher: 'livereload' // Who watches the watcher? Easily switch between BrowserSync ('browsersync') and Livereload ('livereload')
}
}