Creating New Page
To build SSR SPA in Yugal you have to make .php
files in ./src
directory. File save in this directory as index.php
will be treated as root
file, and other files will be indexed as per their name. Example file in ./src
with name about.php
will be indexed as ./about
You have to return string
which contains HTML
code in different tags
. Example, in HTML string to define code that should be injected in body tag of DOM should be written in <body>
, for page specific head tag, use <head>
Lifecycle Methods
From Version 8.9, Yugal only supports two lifecycle methods, which are below. Use script
tag and define lifecycle method in its use
tag to define these methods.
willmount
: This event will be called when page is about to be injected to DOM.didmount
: This event is called when page is injected toDOM
.
Defining CSS in Yugal
Mainly, CSS can be defined in Yugal using three ways.
Adding external CSS file to global
head
of the project.Defining CSS in
<style>
in.php
file of respective page, you can useuse
attribute to tell Yugal, the way it should be processed. Useonpage
value ofuse
attribute to add CSS inline in DOM, and other way is useexternal
as value ofuse
attribute ofstyle
tag, Yugal will process and create a new file for the page and link it with the respective page, so you don't have to take care for it.
Example
Yugal will remove all comments and compress the code, ie no comment in JavaScript, CSS or HTML will be sent to browser.
Always use ;
when writing JavaScript code in Yugal, or the app may crash.
Last updated