https://github.com/sinhapaurush/yugal_spa_lib
https://github.com/sinhapaurush/yugal_spa_lib
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sinhapaurush/yugal_spa_lib
- Owner: sinhapaurush
- Created: 2022-02-27T15:39:19.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-20T13:38:30.000Z (almost 3 years ago)
- Last Synced: 2025-02-12T07:25:44.949Z (about 1 year ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Yugal.JS in Yugal.PHP (SPA)
You can install `Yugal.JS` a *Single Page App Module* in `Yugal.PHP`.
Run command below in your project folder.
```bash
yugal --install https://github.com/sinhapaurush/yugal_spa_lib.git
```
This command will install `Yugal.JS` in your `Yugal.PHP` project.
Follow steps below to configure Single Page Apps (Yugal.JS) in your project.
- In `index.php` or any landing `Yugal.PHP` file and add another `library` in `meta` function.
```php
meta(
array(
"title"=>"Yugal App",
...
"library"=>array(
...
+ "yugal_spa_lib"
)
)
);
```
In above code, `...` represents other codes, don't forget to remove `+` sign.
- Use `spa_root()` as code to render to screen.
Example
```php
$body = spa_root();
export_screen($body);
```
- Run `create_spa()` after exporting screen to browser and before using `end_doc()`.
Example
```php
$body = spa_root();
export_screen($body);
create_spa(); //THIS function IS VERY IMPORTANT
end_doc(
array()
);
```
Navigate to [Yugal.JS Documentation](https://spa.yugal.ml) to know how to use Yugal.JS.