Skip to content

Instantly share code, notes, and snippets.

@linkdigitaluk
Last active May 14, 2021 13:01
Show Gist options
  • Save linkdigitaluk/745a93fd566b3aaf63fa1ce95965b3e3 to your computer and use it in GitHub Desktop.
Save linkdigitaluk/745a93fd566b3aaf63fa1ce95965b3e3 to your computer and use it in GitHub Desktop.
[WP Setup - wpgulp config file] For setting Up WPGulp, make sure yourProject URL matches a virual host set up in Wordpress or you'll have a bad time #wpGulp #NPM
/**
* WPGulp Configuration File
*
* 1. Edit the variables as per your project requirements.
* 2. In paths you can add <<glob or array of globs>>.
*
* @package WPGulp
*/
module.exports = {
// Project options.
projectURL: '[[ Project Url ]]', // Local project URL of your already running WordPress site. Could be something like site.local or localhost:3000 depending upon your local WordPress setup.
productURL: './', // Theme/Plugin URL. Leave it like it is, since our gulpfile.js lives in the root folder.
browserAutoOpen: true,
injectChanges: true,
// Style options.
styleSRC: './sass/style.scss', // Path to main .scss file.
styleDestination: './', // Path to place the compiled CSS file. Default set to root folder.
outputStyle: 'expanded', // Available options → 'compact' or 'compressed' or 'nested' or 'expanded'
errLogToConsole: true,
precision: 10,
// JS Vendor options.
jsVendorSRC: './js/src/vendor/*.js', // Path to JS vendor folder.
jsVendorDestination: './js/', // Path to place the compiled JS vendors file.
jsVendorFile: 'vendor', // Compiled JS vendors file name. Default set to vendors i.e. vendors.js.
// JS Custom options.
jsCustomSRC: './js/src/custom/*.js', // Path to JS custom scripts folder.
jsCustomDestination: './js/', // Path to place the compiled JS custom scripts file.
jsCustomFile: 'main', // Compiled JS custom file name. Default set to custom i.e. custom.js.
// Images options.
imgSRC: './img/raw/**/*', // Source folder of images which should be optimized and watched. You can also specify types e.g. raw/**.{png,jpg,gif} in the glob.
imgDST: './img/', // Destination folder of optimized images. Must be different from the imagesSRC folder.
// Watch files paths.
watchStyles: './sass/**/*.scss', // Path to all *.scss files inside css folder and inside them.
watchJsVendor: './js/src/vendor/*.js', // Path to all vendor JS files.
watchJsCustom: './js/src/custom/*.js', // Path to all custom JS files.
watchPhp: './**/*.php', // Path to all PHP files.
// Browsers you care about for autoprefixing. Browserlist https://github.com/ai/browserslist
// The following list is set as per WordPress requirements. Though, Feel free to change.
BROWSERS_LIST: [
'last 2 version',
'> 1%',
'ie >= 11',
'last 1 Android versions',
'last 1 ChromeAndroid versions',
'last 2 Chrome versions',
'last 2 Firefox versions',
'last 2 Safari versions',
'last 2 iOS versions',
'last 2 Edge versions',
'last 2 Opera versions'
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment