JoonWeb template documentation
[Template Structure]
+ assets
└contains assets such as js/css/default_images
+ rules
└contains sections rules/settings in jsonfile
+ sections
└contains section views/design in HTML/JW file
- layout.jw
- theme_config.json
- theme_sections.json
Name | Information | files/dir details |
asset | This folder contains all the default media, css and Js files | assets/ |
rules | This folder contains, section settings like slider, colors, animation, alignment and rules/userinput which displays which user can change, also its setting. | Section Setting -> rules/[your_section].json "sections" >> "settings" Rules -> rules/[your_section].json "sections" >> "rules" |
sections | This folder contains section file in JW extension eg about.jw, header.jw, welcome.jw etc. | sections/ |
layout.jw | This file contains the main layout file (without any section) which will be visible in all pages, it is a Layout structure. | layout.jw |
theme_config.json | This json file contains config like: colors, heading, fonts, animation etc. | theme_config.json |
theme_sections.json | This json file contains the collection/category or group of sections mainly helps in "Add New Section" and change design in builder. | theme_sections.json (optional) |
Before creating template for JoonWeb, you need to make sure you have created sections seperately
like header, footer, about us all should be created seperate.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Joonweb">
<title>{{page.seo.title}}</title>
<meta name="description" content="{{page.seo.desc}}">
<link rel="canonical" href="{{current_url}}"/>
<link rel="stylesheet" href=" put css path">
<script src="put js path"></script>
<!-- header_content is system files connect -->
{{ header_content }}
<style>
:root{
--color1: {{ theme.colors.color1.value }};
--color2: {{ theme.colors.color2.value }};
--color3: {{ theme.colors.color3.value }};
--color4: {{ theme.colors.color4.value }};
--color5: {{ theme.colors.color5.value }};
--color6: {{ theme.colors.color6.value }};
--font-prime: '{{ theme.fonts.prime }}';
--font-second: '{{ theme.fonts.second }}';
}
{{ base_style }}
</style>
</head>
<body>
<div id="root">
<!-- here main content will output -->
{{ base_content }}
</div>
<!-- You can include any script/css which includes in all pages -->
{{ base_script }}
</body>
</html>
In above code, {{ header_content }} , {% block base_style %}, {% block base_content %}, {% block base_script %} is mandatory.Tag/Blocks | Description | Required |
page.seo.title | It contains, Meta Title of a Page | Yes |
page.seo.desc | It is a Meta Description of a Page | Yes, Mandatory for SEO |
current_url | It will output the current page url | Yes, For SEO |
assets | It is a url of CDN assets of JoonWeb | Yes, if you use Joonweb library |
header_content | It will output security, apps etc and is mandatory and can be used once. | Yes! It is must for template |
base_style | It will render style of all sections and canbe used once. | Yes! else design will now show |
base_content | Its compulsary for rendering page contents and can be used only once | Yes |
base_script | It will render all scripts, else website will not work | Yes |
root.url | It will show the full url of website. | Optional |
{
"default": {
"headings": {
"heading1": {
"label": "Heading 1",
"font-family": "Arial",
"font-size": "30px"
},
"heading2": {
"label": "Heading 2",
"font-family": "Arial",
"font-size": "28px"
},
"heading3": {
"label": "Heading 3",
"font-family": "Arial",
"font-size": "26px"
},
"heading4": {
"label": "Heading 4",
"font-family": "Arial",
"font-size": "25px"
},
"heading5": {
"label": "Heading 5",
"font-family": "Arial",
"font-size": "24px"
},
"heading6": {
"label": "Heading 6",
"font-family": "Arial",
"font-size": "20px"
},
"paragraph1": {
"label": "Paragraph 1",
"font-family": "Arial",
"font-size": "16px"
},
"paragraph2": {
"label": "Paragraph 2",
"font-family": "Arial",
"font-size": "14px"
},
"paragraph3": {
"label": "Paragraph 3",
"font-family": "Arial",
"font-size": "12px"
}
},
"colors": {
"color1": { "value": "#ffbeac" },
"color2": {"value": "#ffefec" },
"color3": { "value": "#b32121" },
"color4": { "value": "#945151" },
"color5": { "value": "#3e4a4f" },
"color6": { "value": "#d62828" }
},
"fonts":{
"prime": "Arial",
"second":"Ubuntu"
}
}
}
Here, you can fetch the value of "default" with object "theme" and render like {{ theme.fonts.prime }} it will output "Arial".Next, you need to know that css you write should be mostly of root specially for colors and fonts.
As you need, before creating any template you have to decide in which main 3-4 or 5 colors you want it to design in.
Eg colors be like:
:root{--color1: 'red', --color2: 'lightred', --color3: 'white', --color4: '#000', --font-prime: 'Arial', -font-second: 'Comic Sans'}
This is your first step in creating global css, next is to make it dynamic. You can check "theme_config.json" for better understanding.
current/default preset will accessed through object "theme" you can fetch the data from theme_config.json, so property be like {{ theme.colors.color1.value }}
so the dynamically created root be like:
:root{
--color1: {{ theme.colors.color1.value }};
--color2: {{ theme.colors.color2.value }};
--color3: {{ theme.colors.color3.value }};
--color4: {{ theme.colors.color4.value }};
--color5: {{ theme.colors.color5.value }};
--color6: {{ theme.colors.color6.value }};
--font-prime: '{{ theme.fonts.prime }}';
--font-second: '{{ theme.fonts.second }}';
}
theme.colors.color1.value will fetch the data from theme_config.json >> default >> colors >> color1 >> value.
More, proper example you can check in layout.jw in cloned template and theme_config.json.
Also think about creating dynamic, rather than static.. Specially you need to focus on header section..
Don't put margin manually on each section for fixed header thing.. you need to make it auto through JS if you would like to give property of fix header to users.
One more thing, you need to make settings yourself what you want your users to have it, section settings includes: colors, sliders, animation, alignment etc.
You will get to know more in section settings define in "rules" folder of template in thier respective json file.
Create your dream design in HTML/CSS/JS in section wise.
Now sepeate all sections from your template in JW files, example:
{
"sections": {
"settings":[],
"rules":{
"title": {
"label": "Enter Title",
"type": "text",
"show": "yes",
"default": "About US"
},
"subtitle": {
"label": "Enter Subtitle",
"type": "quickEditor",
"show": "yes",
"default": "Hello dear welcome"
},
"description": {
"label": "Description",
"type": "simpleEditor",
"show": "yes",
"default": "This is a sample description hope you like it buddy"
},
"media": {
"label": "Uplaod Media",
"type": "singlefile",
"show": "yes"
}
}
}
}
{
"label":"Slider",
"id": "slider",
"type": "custom",
"elements":[
{
"label": "Enable Slider",
"id": "enable",
"type": "select",
"options":[
{"label": "Yes", "value": "yes"},
{"label":"No","value":"no"}
],
"default": "no"
},
{
"label": "Autoplay",
"id": "enable",
"type": "select",
"options":[
{"label": "Yes", "value": "yes"},
{"label":"No","value":"no"}
],
"default": "no"
},
{
"label": "Slide to Show",
"id": "slides",
"type": "select",
"options":[
{"label": "1", "value": "1"},
{"label":"2","value":"2"}
],
"default": "1"
}
]
}
Input Field (type in elements) | Detail |
text | render input type text for write. |
select | render <select>, "option" paramaters is necessary with label and value. |
textarea | render textarea in setting |
singlefile | render image upload in setting |
chooser | render chooser, like radio element |
color | render color chooser |
datetime | render date/time input |
heading | render static heading for collapse. |
range | render range |
radio | render radio button |
checkbox | rendering checkbox for selecting multiple choices |
{
"title": {
"label": "Big Headings",
"type": "text",
"show": "yes",
"default": "About US"
}
}
Here,Rule Type | Detail |
text | will render input text for UI, and output the same |
textarea | will render simple textarea |
will render input type email | |
number | will render input type number |
datetime | it will render datetime picker |
quickeditor | it will render simple textarea with features like Bold, Italic, underline, alignment and color |
simpleEditor | It is more advance than quickeditor and contains more features. |
hrefbutton | It will output "button" setting/ui |
singlefile | contains media input for uploading file for user. |
siteform | contain default form |
sitegallery | contains default gallery |
socialicon | Rendering social Icons |
"subsection": {
"fields": {
"item_name": {
"label": "Service Name",
"type": "text",
"info": "",
"show": "yes"
},
"media": {
"label": "Media",
"type": "singlefile",
"info": "",
"show": "yes"
}
}
}