Development environment with gulp and docker for developing and deploying WordPress themes.
Node.js: https://nodejs.org/en
$ node -v
v10.16.3
Docker Desktop: https://www.docker.com/products/docker-desktop
$ docker -v
Docker version 20.10.6, build 370c289
Composer: https://getcomposer.org/download
$ composer -v
Composer version 2.0.13 2021-04-27 13:11:08
- Add domain.com
- Add stage.domain.com
- Add live database
- Add stage database
- Add [email protected] ftp account => /public_html
- Add [email protected] ftp account => /public_html/stage Make shure you have all accounts unlocked and remote mysql access activated (just for connecting with sql-client)
Create an SSH key:
ssh-keygen -b 4096
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub | clip
git clone https://github.com/marcoris/gulpwordpress.git {projectname}
git remote rename origin {projectname}
Just cd into the project directory and remove the .git folder (rm -rf .git
). However make sure you are in the correct folder when running the above command!
Next you can initialize a new repo by running:
git init
Important!
Make sure to adjust the version number and concrete project information in all relevant files (package.json
, README.md
) then run:
sh ./shells/installer.sh
to install all npm dependencies, setting up the devEnv, installing composer packages and running gulp.
WordPress plugins have to be installed separately after the installer did his job.
- Fill in all your necessary data into the generated
.env
file - Run
gulp
to start de watchers and browserSync - Happy coding
command | description |
---|---|
npm run updater |
Runs npm update and npm audit fix and composer update |
npm run start |
Runs gulp |
npm run build |
Runs gulp build --prod => This is not done yet |
npm run gettableprefix |
Shows the productive table prefix (if wp is installed) |
npm run gettableprefix stage |
Shows the staging table prefix (if wp is installed) |
npm run dbexport local |
Exports the local database -> sql/local.sql (local) |
npm run dbexport stage |
Exports the staging database -> sql/stage.sql (remotly) |
npm run dbexport prod |
Exports the production database -> sql/prod.sql (remotly) |
npm run dbimport local |
Imports the local database -> sql/local.sql (local) |
npm run dbimport stage |
Imports the staging database -> sql/stage.sql (remotly) |
npm run dbimport prod |
Imports the production database -> sql/prod.sql (remotly) |
npm run deploy stage |
Deploys the Uploads and theme or wwwroot directories on stage |
npm run deploy prod |
Deploys the Uploads and theme or wwwroot directories on production |
npm run importRemoteDB-prod |
Imports the production database into local |
npm run importRemoteDB-stage |
Imports the staging database into local |
command | description |
---|---|
gulp firstSetup | Seting up for development |
gulp | Default gulp command |
gulp dev | Default gulp command, runs cleaner, docs, makepot, serve and watchers |
gulp build | Builds the theme in cleared directories |
gulp buildZip | Builds the theme in cleared directories and zip it |
gulp bump | Gives a bump version prompt to choose between patch, minor and major and adds the bumped files (CHANGELOG.md , README.md , package.json ), commit them with a release message, add a tag and push it to github |
gulp push | Pushes the local themes , uploads or both directories to remote |
gulp pull | Pulls the remote themes , uploads or both directories to local |
gulp makepot | Makes the *.pot file |
gulp docs | Runs the nucleus styleguide building script |
gulp shot | Generates the screenshot.png - Cheeeeese ๐ |
gulp setupWPConfig | Sets the wp-config.php file for local use |
gulp setupWPConfig --stage | Sets the wp-config.php file for staging use |
gulp setupWPConfig --prod | Sets the wp-config.php file for production use |
gulp deploy --stage | Deploys the Uploads and theme or wwwroot directories to the staging server |
gulp deploy --prod | Deploys the Uploads and theme or wwwroot directories to the production server |
gulp updateACFPro | Updates the ACF Pro plugin (ACF Pro version has to be set in the .env file) |
gulp WPUpdate | Checks the installed WordPress version and if it is not up to date install automatically the newest version (new WordPress version has to be set in the .env file). This can take several minutes! |
To import the remote database into the local database run:
npm run importRemoteDB-prod
or
npm run importRemoteDB-stage
To import the local sqldump to the staging database run:
npm run dbexport local
gulp replaceDBStrings --local=stage
npm run dbimport stage
To import the local sqldump to the production database run:
npm run dbexport local
gulp replaceDBStrings --local=prod
npm run dbimport prod
To download all needed remote files (it will ask you in a prompt what you want to download) run:
gulp pull
To upload all needed files (it will ask you in a prompt what you want to upload) run:
gulp push
Set the new Versionnumber in the .env
file under WP_VERSION
. Then run gulp WPUpdate
. This can take several minutes!
If there is no {themename}.pot
file in the src/languages
folder run the following command to make the {themename}.pot
file: gulp makepot
.
Then make the translation in wich language you want and save it as {themename}-lang_LANG.po
file.
- Run
npm run gettableprefix-prod
ornpm run gettableprefix-stage
if there is an installation to fill the table prefix in the.env
file - Run
npm run deploy stage
ornpm run depoly prod
- Then you have to choose between
wwwroot
oruploads and theme
Made with โค๏ธ in Switzerland.