Setting Up Your Local Environment: Difference between revisions
From Joomla! Documentation
No edit summary |
Add note about platform reqs, some formatting and English cleanup |
||
| Line 1: | Line 1: | ||
With Joomla 4 we have changed the development process, it is | With Joomla 4 we have changed the development process, it is no longer possible to clone the repository and have a usable Joomla installation. We follow here best practices and have implemented a build process for the CMS. | ||
== Quick start guide == | == Quick start guide == | ||
| Line 6: | Line 6: | ||
=== Tools you need === | === Tools you need === | ||
# PHP - basically the same as you need for running a Joomla Site, but you need the | # PHP - basically the same as you need for running a Joomla Site, but you need the PHP CLI (command line interface) Version (see the [[S:MyLanguage/Configuring_a_LAMPP_server_for_PHP_development|Configuring a LAMPP server for PHP development]] page) | ||
# Composer - for managing Joomla's PHP Dependencies - for help | # Composer - for managing Joomla's PHP Dependencies - for help installing Composer read the documentation at https://getcomposer.org/doc/00-intro.md | ||
# Node.js - for compiling Joomla's | # Node.js - for compiling Joomla's JavaScript and SASS files - for help installing Node.js please follow the instructions available on https://nodejs.org/en/ | ||
# Git - for version management | # Git - for version management | ||
| Line 14: | Line 14: | ||
# Clone the repository | # Clone the repository | ||
# run | # run <tt>composer install</tt> from the root of the git repo | ||
# run | # run <tt>npm install</tt> from the root of the git repo | ||
== The a bit longer start guide == | == The a bit longer start guide == | ||
Joomla is not different to many other web tools these days. It has a large PHP part and it has more and more | Joomla is not different to many other web tools these days. It has a large PHP part and it has more and more JavaScript code. While PHP coding doesn't need so much preparation, JavaScript needs a lot tooling around. The main reason is that nobody writes code in a way that every browser understands, so the code needs transpiling from e.g. ES6 to a compatible version of JavaScript. The same is true for CSS, for Joomla we are using SASS and this will be converted to native CSS so that any browser understands it. As downside setting up a dev environment is a bit more complicated but the tooling make coding also more convenient. Thanks to watchers and browser auto reload you can see your change in real time. | ||
=== PHP === | === PHP === | ||
It should be enough to run | It should be enough to run <tt>composer install</tt> as this will install PHP dependencies saved in the composer.lock file. You can do this as many times as you like, it will only install new packages when the composer.lock file is changed. Don't run <tt>composer update</tt> as this will update all packages to newer versions and update the composer.lock file. | ||
Note: You may need to run <tt>composer install</tt> with the <tt>--ignore-platform-reqs</tt> option to ignore platform requirements specified in Composer, i.e. if you do not have PHP's LDAP extension installed. | |||
=== Node/npm scripts === | === Node/npm scripts === | ||
Node.js comes with a package manager called | Node.js comes with a package manager called NPM (in some way the same as Composer). NPM has a <tt>run</tt> command and we have prepared some scripts to make your life easier. You have to run the commands for the root of the repository. | ||
==== npm run build:css ==== | ==== npm run build:css ==== | ||
| Line 31: | Line 33: | ||
==== npm run build:js ==== | ==== npm run build:js ==== | ||
It will compile the | It will compile and transpile the JavaScript files to the correct format and create minified files | ||
==== npm run watch:css ==== | ==== npm run watch:css ==== | ||
This will watch | This is the same as the <tt>build:css</tt> command but will watch for changes and automatically build updated files | ||
==== npm run watch:js ==== | ==== npm run watch:js ==== | ||
This will watch | This is the same as the <tt>build:js</tt> command but will watch for changes and automatically build updated files | ||
==== npm run lint:js ==== | ==== npm run lint:js ==== | ||
This will make a syntax check on | This will make a syntax check on JavaScript files | ||
==== npm run test ==== | ==== npm run test ==== | ||
This will run other | This will run other JavaScript testing suite | ||
[[Category:Development]] | [[Category:Development]] | ||
[[Category:Joomla! 4.x]] | [[Category:Joomla! 4.x]] | ||
Revision as of 20:58, 28 July 2018
With Joomla 4 we have changed the development process, it is no longer possible to clone the repository and have a usable Joomla installation. We follow here best practices and have implemented a build process for the CMS.
Quick start guide
What you have to do to setup you dev environment depends on your operating system. We can not write documentation for any OS so you should answer your favorite search engine to find a HowTo.
Tools you need
- PHP - basically the same as you need for running a Joomla Site, but you need the PHP CLI (command line interface) Version (see the Configuring a LAMPP server for PHP development page)
- Composer - for managing Joomla's PHP Dependencies - for help installing Composer read the documentation at https://getcomposer.org/doc/00-intro.md
- Node.js - for compiling Joomla's JavaScript and SASS files - for help installing Node.js please follow the instructions available on https://nodejs.org/en/
- Git - for version management
Steps to setup the local environment
- Clone the repository
- run composer install from the root of the git repo
- run npm install from the root of the git repo
The a bit longer start guide
Joomla is not different to many other web tools these days. It has a large PHP part and it has more and more JavaScript code. While PHP coding doesn't need so much preparation, JavaScript needs a lot tooling around. The main reason is that nobody writes code in a way that every browser understands, so the code needs transpiling from e.g. ES6 to a compatible version of JavaScript. The same is true for CSS, for Joomla we are using SASS and this will be converted to native CSS so that any browser understands it. As downside setting up a dev environment is a bit more complicated but the tooling make coding also more convenient. Thanks to watchers and browser auto reload you can see your change in real time.
PHP
It should be enough to run composer install as this will install PHP dependencies saved in the composer.lock file. You can do this as many times as you like, it will only install new packages when the composer.lock file is changed. Don't run composer update as this will update all packages to newer versions and update the composer.lock file.
Note: You may need to run composer install with the --ignore-platform-reqs option to ignore platform requirements specified in Composer, i.e. if you do not have PHP's LDAP extension installed.
Node/npm scripts
Node.js comes with a package manager called NPM (in some way the same as Composer). NPM has a run command and we have prepared some scripts to make your life easier. You have to run the commands for the root of the repository.
npm run build:css
It will compile SASS files to CSS and also create the minified files
npm run build:js
It will compile and transpile the JavaScript files to the correct format and create minified files
npm run watch:css
This is the same as the build:css command but will watch for changes and automatically build updated files
npm run watch:js
This is the same as the build:js command but will watch for changes and automatically build updated files
npm run lint:js
This will make a syntax check on JavaScript files
npm run test
This will run other JavaScript testing suite