WordPress base repository for any project.
- LOCAL: ~
- LOCAL ADMIN: ~
- DEV: ~
- DEV ADMIN: ~
- PRE: ~
- PRE ADMIN: ~
- PRO: ~
- PRO ADMIN: ~
Built with WordPress platform using the following technologies: HTML 5, JavaScript, jQuery, CSS3, SASS, Lando (Docker), NPM or Yarn, Gulp v.4 and Deployer.
For your projects I recommend underscores theme. More information about:
- Website: https://underscores.me/
- Theme: https://github.com/automattic/_s
Note: You can install the WooCommerce boilerplate and not sassify if it is ecommerce.
- You have to install Lando: https://docs.devwithlando.io/
If Lando's tools does not work for you, there is another way. You must install the environment manually: XAMP, Composer, Node.JS, NPM or Yarn and Gulp CLI.
For more information visit:
- XAMP: https://www.apachefriends.org/es/index.html
- Composer: https://getcomposer.org/
- Node and NPM: https://nodejs.org/es/
- Yarn: https://yarnpkg.com/es-ES/
- Gulp: https://gulpjs.com/
Note: If you work with Windows < 10. To execute the commands, we recommend installing Cygwin http://www.cygwin.com/
Note: If you work with Windows 10. To execute the commands, we recommend installing WSL 2 with Ubuntu https://docs.microsoft.com/es-es/windows/wsl/install-win10
Note: If you work with Windows 10. You need install the following package: https://www.npmjs.com/package/win-node-env
Note: I recommend installing the following IDE for PHP Programming: Visual Studio Code (https://code.visualstudio.com/) or PHPStorm (recommended) (https://www.jetbrains.com/phpstorm/).
├─ .husky/ # Husky directory (git-hooks)
├─ assets/ # Front-end directory
│ ├─ acf/
│ ├─ fonts/
│ ├─ img/
│ ├─ js/
│ ├─ scss/
│ ├─ .htaccess.dist
│ └─ .htpasswd.dist
├─ gulp/
│ ├─ task/
│ └─ config.js # Paths and configuration Gulp system.
├─ private/
├─ public/ # WordPress directory
├─ .babelrc
├─ .editorconfig
├─ .env.dist
├─ .gitignore
├─ .jshintignore
├─ .jshintrc
├─ .lando.yml
├─ .stylelintignore
├─ .stylelintrc
├─ commitlint.config.js
├─ composer.json
├─ deploy.php
├─ deploy.sh
├─ deploy-exclude-list.txt
├─ gulpfile.babel.js
├─ LICENSE
├─ package.json
├─ phpcs.xml
├─ README.md
└─ validate.sh
- Open the
README.mdand rename the name of client, name of project and description. - Open the
lando.ymland rename the project and proxy name. - If required.
- Download and install the main theme. Recommended: https://underscores.me/
- Add the following path
public/wp-content/themes/[theme]/assetsinto.gitignorefile. - Open the
gulp/config.jsand rename thethemeconst according theme path. - Copy the
public/wp-config-sample.phptopublic/wp-config.php.- Add the following code:
<?php define( 'WP_MEMORY_LIMIT', '256M' ); define( 'AUTOMATIC_UPDATER_DISABLED', true ); define( 'WP_ENVIRONMENT', 'dev' ); define( 'WP_CACHE', false ); define( 'DISALLOW_FILE_EDIT', true ); ... define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', true ); ...
- Change these credentials:
define( 'DB_NAME', 'wordpress' );define( 'DB_USER', 'wordpress' );define( 'DB_PASSWORD', 'wordpress' );define( 'DB_HOST', 'database' );define( 'DB_CHARSET', 'utf8mb4' );define( 'DB_COLLATE', 'utf8mb4_general_ci' );
- Change Authentication Unique Keys and Salts. Open the link
https://api.wordpress.org/secret-key/1.1/salt/, copy and replace in the correct section. - Change table prefix. Only numbers, letters, and underscores. For example:
$table_prefix = 'j28p_';
- Copy the
assets/.htaccess.disttopublic/.htaccessand to remove the code that you do not need. - Open the
phpcs.xmland rename theao-apoloaccording theme path. - If required. Copy the
.env.distto.envand look the vars according Deployer filedeploy.php. - Open your terminal and browse to the root location of your project.
- Run
$lando start.- The project has a .lando.yml file with all the environment settings.
- The command starts the installation process when it finishes, you can see all the URLs to access.
- Run:
$lando composer install. - Run:
$lando npm install --save-devor$lando yarn install --dev. - Run:
$lando npm run prepare. - End. Happy developing.
- Open your terminal and browse to the root location of your project.
- If required. Run:
$lando npm install --save-devor$lando yarn install --devthen:$lando npm run prepare - To work with and compile your Sass and JS files on the fly start:
$lando gulpor$lando npm run gulp:dev - Gulp actions commands list:
$lando gulp cleanDelete all files.$lando gulp cssCompile SASS to CSS and validate SASS according Stylelint (https://stylelint.io/). Not concat.$lando gulp cssAssetsCopy CSS assets to public directory.$lando gulp cssCriticalCopy critical CSS assets to public directory.$lando gulp cssWithConcatConcat and compile SASS to CSS and validate SASS according Stylelint (https://stylelint.io/).$lando gulp fontAssetsCopy fonts assets to public directory.$lando gulp imagesCopy and minify PNG, JPEG, GIF and SVG images with imagemin.$lando gulp imagesAssetsCopy and minify PNG, JPEG, GIF and SVG assets images with imagemin.$lando gulp jsValidate the code with JSHint. Minify the JS files.$lando gulp jsAssetsCopy JS assets to public directory.$lando gulp jsWithConcatValidate the code with Jshint. Concat and minify the JS files.$lando gulp validateValidate JS with JSHint (https://jshint.com/) and SCSS according Stylint (https://stylelint.io/).$lando gulp validateJsValidate JS with JSHint (https://jshint.com/).$lando gulp validateScssValidate SCSS according Stylint (https://stylelint.io/).$lando gulp watchCompile SASS to CSS and concat and minify JS files in real-time.
- NPM actions commands list:
$lando npm run prepareEnable Git hooks. Important: Run always after npm install.$lando npm run gulp:devCompile for development environment.$lando npm run gulp:prodCompile for production environment.$lando npm run gulp:validateRun validate JS and SCSS files.
- If required. Run:
$lando composer install. - If you deploy with Deployer. Copy the
.env.distto.envand you add the server credentials and git repository. - Deployer actions commands list:
$lando dep deploy localDeploy to the local machine in the docker container.$lando dep deploy devDeploy to the dev production server.$lando dep deploy preDeploy to the pre production server.$lando dep deploy proDeploy to the production server.
- If you work with PHP CodeSniffer. If required run
$lando phpcs --config-set installed_paths /path/to/wpcs$lando phpcsor$lando composer csRuns the phpcs$lando phpcbfor$lando composer cs:fixRuns the phpcbf
- Important. Run the shell script to validate PHP, JS and SCSS files:
$sh validate.sh
I recommend using Conventional Commits a specification for adding human and machine readable meaning to commit messages.
https://www.conventionalcommits.org/
Commitlint is a NPM package that you can use to validate your syntax commit message. Integrated with husky package.
https://commitlint.js.org/ https://github.com/conventional-changelog/commitlint
# Lint from stdin.
echo 'foo: bar' | commitlint
# Lint last commit from history.
commitlint --from=HEAD~1Commitizen is a NPM package that you can use to help your syntax commit message.
http://commitizen.github.io/cz-cli/
# Helper to write a good commit message.
git add .
git czThe present project uses several technologies and tools for the automation and development process. For more information and learning visit the following links.
- WordPress: https://wordpress.org/
- Lando: https://docs.devwithlando.io/
- Docker: https://www.docker.com/
- Git: https://git-scm.com/
- Apache: https://www.apache.org/
- MariaDB: https://mariadb.org/
- MySQL: https://www.mysql.com/
- PHP: https://www.php.net/
- Composer: https://getcomposer.org/
- PHP_CodeSniffer: https://github.com/squizlabs/PHP_CodeSniffer
- PhpMyAdmin: https://www.phpmyadmin.net/
- Deployer: https://deployer.org/
- Node.js: https://nodejs.org/
- NPM: https://www.npmjs.com/
- Yarn: https://yarnpkg.com/
- Gulp: https://gulpjs.com/
- Mailhog: https://github.com/mailhog/MailHog
- EditorConfig: https://editorconfig.org/
- Husky: https://www.npmjs.com/package/husky
- Commitlint: https://commitlint.js.org/
- Commitizen: http://commitizen.github.io/cz-cli/
- Human.txt: http://humanstxt.org/
- Security.txt: https://securitytxt.org/
Note: Thanks all people to work on these projects.
- It is very important that if you deploy the project to publish. The DocumentRoot on the VirtualHost has to point to the public/ directory.
- It is very important that if you deploy the project to publish with Deployer. The DocumentRoot on the VirtualHost has to point to the current/public/ directory.
- At the moment you can not update the
delpackage because it generates an error. I will investigate in the following commitments. - At the moment you can not update the
gulp-imageminpackage because it generates an error. I will investigate in the following commitments. - You can not update the
stylelintandstylelint-config-standard-scssbecause@ronilaukkarinen/gulp-stylelintpackage cannot work with them.
- It is possible that on Mac OS the Gulp tasks do not run the correct form. In this case install NodeJS, NPM and Gulp-cli in your OS and execute the tasks outside the Docker containers.
Remove all themes or plugins that you don't use.
More information on the following commits. If required.
Grettings @jjpeleato.