|
Learning with Texts - Fork 2.4.0-fork
Learn foreign languages with texts
|
This guide is mainly aimed for developers, but it can give useful insights on how LWT is structured, which could help you for debugging. The first step you need to take is to clone LWT from the official GitHub repository (HugoFara/lwt).
Getting Composer is required if you want to edit LWT on the server side, but it will also make be useful to edit JS and CSS code, so it is highly recommended. Composer is a light-weight dependency manager that does not need a server for running.
Once Composer is ready, go the the lwt folder (most likely lwt/), and type
This will automatically dowload all the required dependencies.
Themes are stored at src/themes/. If you want to create a new theme, simply add it in a subfolder. You can also edit existing themes.
To apply the changes you made on a theme, run
This command will minify all CSS and JS.
Alternatively, you can run
It minifies CSS only.
You may not want to see your code minified, so you can use
It has the same effect as copying the folder scr/themes/ to themes/. WARNING: it can break your relative paths!
We support a smart minifying system: relative path are automatically adapted to point to the previous location while minifying only. As a consequence:
css/images/ in your theme.src/themes/mytheme/, you should use the path ../../../css/theimage../myimage.When debugging your theme, files are simply copied to the themes/ folder, which can break the path to files in css/.
That's not a problem at all. When LWT looks for a file that should be contained in src/themes/{{The Theme}}/, it checks if the file exists. If not, it goes to css/ and tries to get the same file. With this system, your themes does not need to have the same files as src/css/.
As with themes, LWT minifies JS code for a better user experience. Please refer to the previous section for detailed explanations, this section will only go through import points.
Clear code is stored at src/js/. Once again, the actual code used by LWT should be at js/. After you have done any modification, either run composer minify or php -r "require 'src/php/minifier.php'; minifyAllJS();".
To copy code in a non-obfuscated form, run composer no-minify, or replace the content of js/ by src/js/.
The PHP codebase is not yet well structured, but here is a general organisation:
do_text.php, do_test.php, etc...)inc/ ("include") folder.src/php/.It is higly advised to test your code. Tests should be wrote under tests/. We use PHP Unit for testing.
To run all tests:
composer test
Alternatively:
./vendor/bin/phpunit
We use Psalm to find code flaws and inconsistencies. Use ./vendor/bin/psalm.
Your can configure the reporting level in psalm.xml.
Nobody likes to debug unreadable code. A good way to avoid thinking about it is to include phpcs directly into your IDE. You can also download it and run it regularly on your code.
To regenerate all documentation, use composer doc.
The documentation in split across Markdown (.md) files in docs/. Then, those files are requested by info.php. The final version is info.html, that contains all files.
To regenerate info.hml, run composer info.html.
Code documentation (everything under docs/html/) is automatically generated. If you see an error, the PHP code is most likely at fault. However, don't hesitate to signal the issue.
Currently, the documentation is generated through Doxygen (run doxygen Doxyfile to regenerate it), but this is likely to change.
This is an Open-Source project. It means that anyone can contribute, but nobody gets paid for improving it. Dropping a star, leaving a comment or posting an issue is essential, because the only retributions developers get from time spent on LWT is to discuss with users.
LWT is a non-profitable software, so we won't have much time, and no money, to advertise LWT. If you enjoy LWT and want to see it grow, share it!
Either go to the forum of the official LWT version, or come and discuss on the community version.
Thanks for your interest in contributiong!