Gulp tasks and Node utilities for LifterLMS and LifterLMS add-on development
npm install --save-dev lifterlms-lib-tasks
Create a gulpfile
in the root of your project (gulpfile.js
)
The file must contain, at a minimum:
var gulp = require('gulp');
require( 'lifterlms-lib-tasks' )( gulp );
Create a file named .llmsconfig
in the root directory of your project
Example:
{
"build": {
"custom": [ "custom_build_task_1", "custom_build_task_2" ]
},
"pot": {
"bugReport": "https://mybugreports.tld",
"domain": "my-text-domain",
"dest": "i18n/",
"jsClassname": "LLMS_SLUG_l10n",
"jsFilename": "class-llms-slug-l10n.php",
"jsSince": "1.0.0",
"lastTranslator": "Jeffrey Lebowski <thedude@earthlink.com>",
"team": "Team Name <team@myteam.com>",
"package": "my-package-name",
},
"scripts": {
"src": [ "assets/js/\*\*/\*.js", "!assets/js/\*\*/\*.min.js" ],
"dest": "assets/js/"
},
"watch": {
"custom": [
{
"glob": [ "path/to/files/**.js" ],
"tasks": [ "watch_task_1", "watch_task_2" ]
}
],
}
}
gulp build
: Run textdomain, pot, scripts, and styles tasks.gulp pot
: Generates a.pot
file in the configured destination directory (defaults toi18n
)gulp scripts
: Minifies unminified scripts in the configuredscripts.src
glob via uglifyjs and saves them with a.min
suffix in thescripts.dest
directorygulp styles
: Compiles.scss
files to.css
(both minified and unminified) from the configuredstyles.src
glob via gulp-sass and saves in thestyles.dest
directory.gulp textdomain
: Ensures all WP i18n functions have the text domain specified bypot.domain
.gulp versioner -V X.X.X
: Replaces all instances of "@deprecated [version]", "@since [version]", & "@version [version]" with the supplied version number in specifed files. Usesversioner.src
glob. Ifversioner.scripts
is true, adds glob defined inscripts.src
.gulp watch
: Watch all configuredsrc
directories for pot, scripts, and styles tasks and re-run them on change.