Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit dc7f26d

Browse files
authored
Merge pull request #43 from synapticism/develop
Merge recent changes
2 parents 9eeafc4 + e8c7d92 commit dc7f26d

File tree

15 files changed

+148
-167
lines changed

15 files changed

+148
-167
lines changed

gulpconfig.js

Lines changed: 102 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
11
// ==== CONFIGURATION ==== //
22

33
// Project paths
4-
var project = 'voidx' // The directory name for your theme; change this at the very least!
5-
, src = './src/' // The raw material of your theme: custom scripts, SCSS source files, PHP files, images, etc.; do not delete this folder!
6-
, build = './build/' // A temporary directory containing a development version of your theme; delete it anytime
7-
, dist = './dist/'+project+'/' // The distribution package that you'll be uploading to your server; delete it anytime
8-
, assets = './assets/' // A staging area for assets that require processing before landing in the source folder (example: icons before being added to a sprite sheet)
9-
, bower = './bower_components/' // Bower packages
10-
, composer = './vendor/' // Composer packages
11-
, modules = './node_modules/' // npm packages
12-
;
4+
var project = 'voidx', // The directory name for your theme; change this at the very least!
5+
src = './src/', // The raw material of your theme: custom scripts, SCSS source files, PHP files, images, etc.; do not delete this folder!
6+
build = './build/', // A temporary directory containing a development version of your theme; delete it anytime
7+
dist = './dist/'+project+'/', // The distribution package that you'll be uploading to your server; delete it anytime
8+
assets = './assets/', // A staging area for assets that require processing before landing in the source folder (example: icons before being added to a sprite sheet)
9+
bower = './bower_components/', // Bower packages
10+
composer = './vendor/', // Composer packages
11+
modules = './node_modules/'; // npm packages
1312

1413
// Project settings
1514
module.exports = {
1615

1716
browsersync: {
18-
files: [build+'/**', '!'+build+'/**.map'] // Exclude map files
19-
, notify: false // In-line notifications (the blocks of text saying whether you are connected to the BrowserSync server or not)
20-
, open: true // Set to false if you don't like the browser window opening automatically
21-
, port: 3000 // Port number for the live version of the site; default: 3000
22-
, proxy: 'localhost:8080' // We need to use a proxy instead of the built-in server because WordPress has to do some server-side rendering for the theme to work
23-
, watchOptions: {
17+
files: [build+'/**', '!'+build+'/**.map'], // Exclude map files
18+
notify: false, // In-line notifications (the blocks of text saying whether you are connected to the BrowserSync server or not)
19+
open: true, // Set to false if you don't like the browser window opening automatically
20+
port: 3000, // Port number for the live version of the site; default: 3000
21+
proxy: 'localhost:8080', // We need to use a proxy instead of the built-in server because WordPress has to do some server-side rendering for the theme to work
22+
watchOptions: {
2423
debounceDelay: 2000 // This introduces a small delay when watching for file change events to avoid triggering too many reloads
2524
}
2625
},
2726

2827
images: {
2928
build: { // Copies images from `src` to `build`; does not optimize
30-
src: src+'**/*(*.png|*.jpg|*.jpeg|*.gif|*.svg)'
31-
, dest: build
32-
}
33-
, dist: {
34-
src: [dist+'**/*(*.png|*.jpg|*.jpeg|*.gif|*.svg)', '!'+dist+'screenshot.png'] // The source is actually `dist` since we are minifying images in place
35-
, imagemin: {
36-
optimizationLevel: 7
37-
, progressive: true
38-
, interlaced: true
39-
}
40-
, dest: dist
29+
src: src+'**/*(*.png|*.jpg|*.jpeg|*.gif|*.svg)',
30+
dest: build
31+
},
32+
dist: {
33+
src: [dist+'**/*(*.png|*.jpg|*.jpeg|*.gif|*.svg)', '!'+dist+'screenshot.png'], // The source is actually `dist` since we are minifying images in place
34+
imagemin: {
35+
optimizationLevel: 7,
36+
progressive: true,
37+
interlaced: true
38+
},
39+
dest: dist
4140
}
4241
},
4342

@@ -47,102 +46,109 @@ module.exports = {
4746

4847
scripts: {
4948
bundles: { // Bundles are defined by a name and an array of chunks (below) to concatenate; warning: this method offers no dependency management!
50-
footer: ['footer']
51-
, header: ['header']
52-
, pageloader: ['pageloader', 'footer']
53-
}
54-
, chunks: { // Chunks are arrays of paths or globs matching a set of source files; this way you can organize a bunch of scripts that go together into pieces that can then be bundled (above)
49+
footer: ['footer'],
50+
header: ['header'],
51+
pageloader: ['pageloader', 'footer']
52+
},
53+
chunks: { // Chunks are arrays of paths or globs matching a set of source files; this way you can organize a bunch of scripts that go together into pieces that can then be bundled (above)
5554
// The core footer chunk is loaded no matter what; put essential scripts that you want loaded by your theme in here
5655
footer: [
57-
modules+'timeago/jquery.timeago.js' // The modules directory contains packages downloaded via npm
58-
, src+'js/responsive-menu.js'
59-
, src+'js/footer.js'
60-
]
61-
, header: [
62-
modules+'svg4everybody/dist/svg4everybody.js'
63-
, src+'js/header.js'
64-
]
56+
modules+'timeago/jquery.timeago.js', // The modules directory contains packages downloaded via npm
57+
src+'js/responsive-menu.js',
58+
src+'js/footer.js'
59+
],
60+
header: [
61+
modules+'svg4everybody/dist/svg4everybody.js',
62+
src+'js/header.js'
63+
],
6564
// The pageloader chunk provides an example of how you would add a user-configurable feature to your theme; you can delete this if you wish
6665
// Have a look at the `src/inc/assets.php` to see how script bundles could be conditionally loaded by a theme
67-
, pageloader: [
68-
modules+'html5-history-api/history.js'
69-
, modules+'spin.js/spin.js'
70-
, modules+'spin.js/jquery.spin.js'
71-
, modules+'wp-ajax-page-loader/wp-ajax-page-loader.js'
72-
, src+'js/page-loader.js'
66+
pageloader: [
67+
modules+'html5-history-api/history.js',
68+
modules+'spin.js/spin.js',
69+
modules+'spin.js/jquery.spin.js',
70+
modules+'wp-ajax-page-loader/wp-ajax-page-loader.js',
71+
src+'js/page-loader.js'
7372
]
74-
}
75-
, dest: build+'js/' // Where the scripts end up in your theme
76-
, lint: {
73+
},
74+
dest: build+'js/', // Where the scripts end up in your theme
75+
lint: {
7776
src: [src+'js/**/*.js'] // Linting checks the quality of the code; we only lint custom scripts, not those under the various modules, so we're relying on the original authors to ship quality code
78-
}
79-
, minify: {
80-
src: build+'js/**/*.js'
81-
, uglify: {} // Default options
82-
, dest: build+'js/'
83-
}
84-
, namespace: 'x-' // 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` if you use it)
77+
},
78+
minify: {
79+
src: build+'js/**/*.js',
80+
uglify: {}, // Default options
81+
dest: build+'js/'
82+
},
83+
namespace: 'x-' // 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` if you use it)
8584
},
8685

8786
styles: {
8887
build: {
89-
src: src+'scss/**/*.scss'
90-
, dest: build
91-
}
92-
, compiler: 'libsass' // Choose a Sass compiler: 'libsass' or 'rubysass'
93-
, cssnano: {
88+
src: src+'scss/**/*.scss',
89+
dest: build
90+
},
91+
compiler: 'libsass', // Choose a Sass compiler: 'libsass' or 'rubysass'
92+
cssnano: {
9493
autoprefixer: {
95-
add: true
96-
, browsers: ['> 3%', 'last 2 versions', 'ie 9', 'ios 6', 'android 4'] // This tool is magic and you should use it in all your projects :)
94+
add: true,
95+
browsers: ['> 3%', 'last 2 versions', 'ie 9', 'ios 6', 'android 4'] // This tool is magic and you should use it in all your projects :)
9796
}
98-
}
99-
, rubySass: { // Requires the Ruby implementation of Sass; run `gem install sass` if you use this; Compass is *not* included by default
100-
loadPath: ['./src/scss', bower, modules] // Adds Bower and npm directories to the load path so you can @import directly
101-
, precision: 6
102-
, sourcemap: true
103-
}
104-
, libsass: { // Requires the libsass implementation of Sass (included in this package)
105-
includePaths: ['./src/scss', bower, modules] // Adds Bower and npm directories to the load path so you can @import directly
106-
, precision: 6
107-
, onError: function(err) {
97+
},
98+
rubySass: { // Requires the Ruby implementation of Sass; run `gem install sass` if you use this; Compass is *not* included by default
99+
loadPath: [ // Adds Bower and npm directories to the load path so you can @import directly
100+
'./src/scss',
101+
modules+'normalize.css',
102+
modules+'scut/dist',
103+
modules,
104+
bower
105+
],
106+
precision: 6,
107+
sourcemap: true
108+
},
109+
libsass: { // Requires the libsass implementation of Sass (included in this package)
110+
includePaths: [ // Adds Bower and npm directories to the load path so you can @import directly
111+
'./src/scss',
112+
modules+'normalize.css',
113+
modules+'scut/dist',
114+
modules,
115+
bower,
116+
],
117+
precision: 6,
118+
onError: function(err) {
108119
return console.log(err);
109120
}
110121
}
111122
},
112123

113124
theme: {
114125
lang: {
115-
src: src+'languages/**/*' // Glob pattern matching any language files you'd like to copy over; we've broken this out in case you want to automate language-related functions
116-
, dest: build+'languages/'
117-
}
118-
, php: {
119-
src: src+'**/*.php' // This simply copies PHP files over; both this and the previous task could be combined if you like
120-
, dest: build
126+
src: src+'languages/**/*', // Glob pattern matching any language files you'd like to copy over; we've broken this out in case you want to automate language-related functions
127+
dest: build+'languages/'
128+
},
129+
php: {
130+
src: src+'**/*.php', // This simply copies PHP files over; both this and the previous task could be combined if you like
131+
dest: build
121132
}
122133
},
123134

124135
utils: {
125-
clean: [build+'**/.DS_Store'] // A glob pattern matching junk files to clean out of `build`; feel free to add to this array
126-
, wipe: [dist] // Clean this out before creating a new distribution copy
127-
, dist: {
128-
src: [build+'**/*', '!'+build+'**/*.map']
129-
, dest: dist
130-
}
131-
, normalize: { // Copies `normalize.css` from `node_modules` to `src/scss` and renames it to allow for it to imported as a Sass file
132-
src: modules+'normalize.css/normalize.css'
133-
, dest: src+'scss'
134-
, rename: '_normalize.scss'
135-
}
136+
clean: [build+'**/.DS_Store'], // A glob pattern matching junk files to clean out of `build`; feel free to add to this array
137+
wipe: [dist], // Clean this out before creating a new distribution copy
138+
dist: {
139+
src: [build+'**/*', '!'+build+'**/*.map'],
140+
dest: dist
141+
},
136142
},
137143

138144
watch: { // What to watch before triggering each specified task; if files matching the patterns below change it will trigger BrowserSync or Livereload
139145
src: {
140-
styles: src+'scss/**/*.scss'
141-
, scripts: src+'js/**/*.js' // You might also want to watch certain dependency trees but that's up to you
142-
, images: src+'**/*(*.png|*.jpg|*.jpeg|*.gif|*.svg)'
143-
, theme: src+'**/*.php'
144-
, livereload: build+'**/*'
145-
}
146-
, watcher: 'livereload' // Modify this value to easily switch between BrowserSync ('browsersync') and Livereload ('livereload')
146+
styles: src+'scss/**/*.scss',
147+
scripts: src+'js/**/*.js', // You might also want to watch certain dependency trees but that's up to you
148+
images: src+'**/*(*.png|*.jpg|*.jpeg|*.gif|*.svg)',
149+
theme: src+'**/*.php',
150+
livereload: build+'**/*'
151+
},
152+
watcher: 'livereload' // Modify this value to easily switch between BrowserSync ('browsersync') and Livereload ('livereload')
147153
}
148154
}

gulpfile.js/tasks/browsersync.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// ==== BROWSERSYNC ==== //
22

3-
var gulp = require('gulp')
4-
, browsersync = require('browser-sync')
5-
, config = require('../../gulpconfig').browsersync
6-
;
3+
var gulp = require('gulp'),
4+
browsersync = require('browser-sync'),
5+
config = require('../../gulpconfig').browsersync;
76

87
// BrowserSync: be sure to setup `proxy` in `/gulpconfig.js`
98
// Quick start: connect all your devices to the same network (e.g. wifi) and navigate to the address output in the console when you run `gulp`

gulpfile.js/tasks/images.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// ==== IMAGES ==== //
22

3-
var gulp = require('gulp')
4-
, plugins = require('gulp-load-plugins')({ camelize: true })
5-
, config = require('../../gulpconfig').images
6-
;
3+
var gulp = require('gulp'),
4+
plugins = require('gulp-load-plugins')({ camelize: true }),
5+
config = require('../../gulpconfig').images;
76

87
// Copy changed images from the source folder to `build` (fast)
98
gulp.task('images', function() {

gulpfile.js/tasks/livereload.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// ==== LIVERELOAD ==== //
22

3-
var gulp = require('gulp')
4-
, plugins = require('gulp-load-plugins')({ camelize: true })
5-
, config = require('../../gulpconfig').livereload
6-
;
3+
var gulp = require('gulp'),
4+
plugins = require('gulp-load-plugins')({ camelize: true }),
5+
config = require('../../gulpconfig').livereload;
76

87
// Start the livereload server; not asynchronous
98
gulp.task('livereload', ['build'], function() {

gulpfile.js/tasks/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ var gulp = require('gulp');
55
// Default task chain: build -> (livereload or browsersync) -> watch
66
gulp.task('default', ['watch']);
77

8-
// One-off setup tasks
9-
gulp.task('setup', ['utils-normalize']);
10-
118
// Build a working copy of the theme
129
gulp.task('build', ['images', 'scripts', 'styles', 'theme']);
1310

gulpfile.js/tasks/scripts.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// ==== SCRIPTS ==== //
22

3-
var gulp = require('gulp')
4-
, plugins = require('gulp-load-plugins')({ camelize: true })
5-
, merge = require('merge-stream')
6-
, config = require('../../gulpconfig').scripts
7-
;
3+
var gulp = require('gulp'),
4+
plugins = require('gulp-load-plugins')({ camelize: true }),
5+
merge = require('merge-stream'),
6+
config = require('../../gulpconfig').scripts;
87

98
// Check core scripts for errors
109
gulp.task('scripts-lint', function() {

gulpfile.js/tasks/styles.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// ==== STYLES ==== //
22

3-
var gulp = require('gulp')
4-
, gutil = require('gulp-util')
5-
, plugins = require('gulp-load-plugins')({ camelize: true })
6-
, config = require('../../gulpconfig').styles
7-
;
3+
var gulp = require('gulp'),
4+
gutil = require('gulp-util'),
5+
plugins = require('gulp-load-plugins')({ camelize: true }),
6+
config = require('../../gulpconfig').styles;
87

98
// Build stylesheets from source Sass files, post-process, and write source maps (for debugging) with rubySass
109
gulp.task('styles-rubysass', function() {

gulpfile.js/tasks/theme.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// ==== THEME ==== //
22

3-
var gulp = require('gulp')
4-
, plugins = require('gulp-load-plugins')({ camelize: true })
5-
, config = require('../../gulpconfig').theme
6-
;
3+
var gulp = require('gulp'),
4+
plugins = require('gulp-load-plugins')({ camelize: true }),
5+
config = require('../../gulpconfig').theme;
76

87
// Copy PHP source files to the `build` folder
98
gulp.task('theme-php', function() {

gulpfile.js/tasks/utils.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
// ==== UTILITIES ==== //
22

3-
var gulp = require('gulp')
4-
, plugins = require('gulp-load-plugins')({ camelize: true })
5-
, del = require('del')
6-
, config = require('../../gulpconfig').utils
7-
;
8-
9-
// Used to get around Sass's inability to properly @import vanilla CSS; see: https://github.com/sass/sass/issues/556
10-
gulp.task('utils-normalize', function() {
11-
return gulp.src(config.normalize.src)
12-
.pipe(plugins.changed(config.normalize.dest))
13-
.pipe(plugins.rename(config.normalize.rename))
14-
.pipe(gulp.dest(config.normalize.dest));
15-
});
3+
var gulp = require('gulp'),
4+
plugins = require('gulp-load-plugins')({ camelize: true }),
5+
del = require('del'),
6+
config = require('../../gulpconfig').utils;
167

178
// Totally wipe the contents of the `dist` folder to prepare for a clean build; additionally trigger Bower-related tasks to ensure we have the latest source files
189
gulp.task('utils-wipe', ['setup'], function() {

gulpfile.js/tasks/watch.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// ==== WATCH ==== //
22

3-
var gulp = require('gulp')
4-
, plugins = require('gulp-load-plugins')({ camelize: true })
5-
, config = require('../../gulpconfig').watch
6-
;
3+
var gulp = require('gulp'),
4+
plugins = require('gulp-load-plugins')({ camelize: true }),
5+
config = require('../../gulpconfig').watch;
76

87
// Watch (BrowserSync version): build stuff when source files are modified, let BrowserSync figure out when to reload
98
// Task chain: build -> browsersync -> watch

0 commit comments

Comments
 (0)