Skip to content

Commit 0cd4579

Browse files
committed
Update gulpfile/npm
1 parent ee664f4 commit 0cd4579

File tree

6 files changed

+2612
-15432
lines changed

6 files changed

+2612
-15432
lines changed

.jscsrc

Lines changed: 0 additions & 51 deletions
This file was deleted.

gulpfile.js

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* Gulp with WordPress.
55
*
66
* Implements:
7-
* 1. Live reloads browser with BrowserSync.
87
* 2. CSS: Sass to CSS conversion, error catching, Auto prefixing, Sourcemaps,
98
* CSS minification, and Merge Media Queries.
109
* 3. JS: Concatenates & uglifies Vendor and Custom JS files.
@@ -29,11 +28,6 @@
2928
*/
3029

3130
// START Editing Project Variables.
32-
// Project related.
33-
// var project = 'Redux Framework'; // Project Name.
34-
// var productURL = './'; .
35-
var projectURL = 'http://127.0.0.1/redux-demo'; // Project URL. Could be something like localhost:8888.
36-
3731
// Translation related.
3832
var text_domain = 'redux-framework'; // Your textdomain here.
3933
var destFile = 'redux-framework.pot'; // Name of the translation file.
@@ -58,8 +52,6 @@ var imagesSRC = './redux-core/assets/img/raw/**/*.{png,jpg,gif,svg}'; //
5852
var imagesDestination = './redux-core/assets/img/'; // Destination folder of optimized images. Must be different from the imagesSRC folder.
5953

6054
// Watch files paths.
61-
// var styleWatchFiles = './redux-core/assets/css/**/*.scss'; // Path to all *.scss files inside css folder and inside them.
62-
// var vendorJSWatchFiles = './redux-core/assets/js/vendor/*.js'; // Path to all vendor JS files.
6355
var reduxJSWatchFiles = './redux-core/assets/js/redux/*.js'; // Path to all custom JS files.
6456
var projectPHPWatchFiles = './**/*.php'; // Path to all PHP files.
6557

@@ -97,8 +89,6 @@ var rename = require( 'gulp-rename' ); // Renames files E.g.
9789
var lineec = require( 'gulp-line-ending-corrector' ); // Consistent Line Endings for non UIX systems. Gulp Plugin for Line Ending Corrector (A utility that makes sure your files have consistent line endings).
9890
var filter = require( 'gulp-filter' ); // Enables you to work on a subset of the original files by filtering them using globbing.
9991
var sourcemaps = require( 'gulp-sourcemaps' ); // Maps code in a compressed file (E.g. style.css) back to it’s original position in a source file.
100-
var browserSync = require( 'browser-sync' ).create(); // Reloads browser and injects CSS. Time-saving synchronised browser testing.
101-
// var reload = browserSync.reload; // For manual browser reload.
10292
var wpPot = require( 'gulp-wp-pot' ); // For generating the .pot file.
10393
var sort = require( 'gulp-sort' ); // Recommended to prevent unnecessary changes in pot-file.
10494
var fs = require( 'fs' );
@@ -124,42 +114,6 @@ var styles = [
124114
{'path': './redux-core/inc/welcome/css/redux-banner.scss', 'dest': './redux-core/inc/welcome/css/'}
125115
];
126116

127-
/**
128-
* Task: `browser-sync`.
129-
*
130-
* Live Reloads, CSS injections, Localhost tunneling.
131-
*
132-
* This task does the following:
133-
* 1. Sets the project URL
134-
* 2. Sets inject CSS
135-
* 3. You may define a custom port
136-
* 4. You may want to stop the browser from opening automatically
137-
*/
138-
gulp.task(
139-
'browser-sync',
140-
function() {
141-
browserSync.init(
142-
{
143-
// For more options.
144-
// @link http://www.browsersync.io/docs/options.
145-
// Project URL.
146-
proxy: projectURL,
147-
148-
// `true` Automatically open the browser with BrowserSync live server.
149-
// `false` Stop the browser from automatically opening.
150-
open: true,
151-
152-
// Inject CSS changes.
153-
// Comment it to reload browser for every CSS change.
154-
injectChanges: true
155-
156-
// Use a specific port (instead of the one auto-detected by Browsersync).
157-
// port: 7000.
158-
}
159-
);
160-
}
161-
);
162-
163117
function getFolders( dir ) {
164118
return fs.readdirSync( dir ).filter(
165119
function( file ) {
@@ -194,8 +148,7 @@ function process_scss( source, dest, add_min ) {
194148
.pipe( sourcemaps.write( './' ) )
195149
.pipe( lineec() ) // Consistent Line Endings for non UNIX systems.
196150
.pipe( gulp.dest( dest ) ).pipe( filter( '**/*.css' ) ) // Filtering stream to only css files.
197-
.pipe( mmq( {log: true} ) ) // Merge Media Queries only for .min.css version.
198-
.pipe( browserSync.stream() ); // Reloads style.css if that is enqueued.
151+
.pipe( mmq( {log: true} ) ); // Merge Media Queries only for .min.css version.
199152

200153
if ( add_min ) {
201154
process = process.pipe( rename( {suffix: '.min'} ) ).pipe(
@@ -207,8 +160,7 @@ function process_scss( source, dest, add_min ) {
207160
)
208161
.pipe( lineec() ) // Consistent Line Endings for non UNIX systems.
209162
.pipe( gulp.dest( dest ) )
210-
.pipe( filter( '**/*.css' ) ) // Filtering stream to only css files.
211-
.pipe( browserSync.stream() ); // Reloads style.min.css if that is enqueued.
163+
.pipe( filter( '**/*.css' ) ); // Filtering stream to only css files.
212164
}
213165

214166
return process;
@@ -226,7 +178,6 @@ function process_scss( source, dest, add_min ) {
226178
* 4. Autoprefixes it and generates style.css
227179
* 5. Renames the CSS file with suffix .min.css
228180
* 6. Minifies the CSS file and generates style.min.css
229-
* 7. Injects CSS or reloads the browser via browserSync
230181
*/
231182
function reduxStyles() {
232183

@@ -664,7 +615,7 @@ function installFontawesome( done ) {
664615
done();
665616
}
666617

667-
var exec = require('child_process').exec;
618+
var exec = require( 'child_process' ).exec;
668619

669620
function getFontAwesomeClasses( done ){
670621
exec(

0 commit comments

Comments
 (0)