<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Richard Guay</title>
    <description>The latest articles on DEV Community by Richard Guay (@raguay).</description>
    <link>https://dev.to/raguay</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F67506%2Fd18cb8b6-8d73-48ec-97cb-eb5829576e57.jpg</url>
      <title>DEV Community: Richard Guay</title>
      <link>https://dev.to/raguay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raguay"/>
    <language>en</language>
    <item>
      <title>Sending Emails from Command Line using EmailIt</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Thu, 27 Jul 2023 05:42:31 +0000</pubDate>
      <link>https://dev.to/raguay/sending-emails-from-command-line-using-emailit-34bn</link>
      <guid>https://dev.to/raguay/sending-emails-from-command-line-using-emailit-34bn</guid>
      <description>&lt;p&gt;I just recently released an update to the &lt;a href="https://GitHub.com/raguay/EmailIt" rel="noopener noreferrer"&gt;EmailIt&lt;/a&gt; that includes many great new features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A TUI application for sending emails from the command line&lt;/li&gt;
&lt;li&gt;The body text of all emails are processed through the builtin &lt;a href="///handlebarsjs.com/"&gt;Handlebars&lt;/a&gt; parser to expand macros.&lt;/li&gt;
&lt;li&gt;Removed Script Terminal for Scriptline.&lt;/li&gt;
&lt;li&gt;Added many new API endpoints to use to control EmailIt.&lt;/li&gt;
&lt;li&gt;Many great bug fixes and updates overall. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But, Let's just look at the commandline EmailIt TUI.&lt;/p&gt;

&lt;h2&gt;
  
  
  TUI
&lt;/h2&gt;

&lt;p&gt;The word TUI comes from Terminal User Interface. It is basically creating a graphical user interface in a terminal. The EmailIt program is both a graphic interface and a command line TUI. First download the program from the GitHub repo: &lt;a href="https://github.com/raguay/EmailIt" rel="noopener noreferrer"&gt;https://github.com/raguay/EmailIt&lt;/a&gt;. Unzip it and move it to the &lt;code&gt;/Applications&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;In order to use the program from the command line, you need to make an alias to the programs executable file for the macOS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;em&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/Applications/EmailIt.app/Contents/MacOS/EmailIt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the above line in your &lt;code&gt;.bashrc&lt;/code&gt; or &lt;code&gt;.zshrc&lt;/code&gt; file (you will have to make a similar line for other shells), you can run the EmailIt program from any directory. The different command line options are shown with the basic &lt;code&gt;-h&lt;/code&gt; or &lt;code&gt;--help&lt;/code&gt; flag or the &lt;code&gt;help&lt;/code&gt; or &lt;code&gt;h&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; em &lt;span class="nb"&gt;help
&lt;/span&gt;NAME:
   EmailIt - A program &lt;span class="k"&gt;for &lt;/span&gt;sending emails, working with text, and scripts.

USAGE:
   EmailIt &lt;span class="o"&gt;[&lt;/span&gt;global options] &lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;command &lt;/span&gt;options] &lt;span class="o"&gt;[&lt;/span&gt;arguments...]

VERSION:
   v2.1.0

AUTHOR:
   Richard Guay &amp;lt;raguay@customct.com&amp;gt;

COMMANDS:
   mkemail, me     Create an email using a TUI
   notes, n        Open the notes.
   emailit, e      Open the EmailIt email sending application.
   scriptline, sl  Open the ScriptLine application.
   sendemail, se   Send the email directly. No GUI or TUI.
   &lt;span class="nb"&gt;help&lt;/span&gt;, h         Shows a list of commands or &lt;span class="nb"&gt;help &lt;/span&gt;&lt;span class="k"&gt;for &lt;/span&gt;one &lt;span class="nb"&gt;command

&lt;/span&gt;GLOBAL OPTIONS:
   &lt;span class="nt"&gt;-a&lt;/span&gt; value       Address to send an email
   &lt;span class="nt"&gt;-s&lt;/span&gt; value       Subject &lt;span class="k"&gt;for &lt;/span&gt;the email
   &lt;span class="nt"&gt;-b&lt;/span&gt; value       Body of the email
   &lt;span class="nt"&gt;--help&lt;/span&gt;, &lt;span class="nt"&gt;-h&lt;/span&gt;     show &lt;span class="nb"&gt;help&lt;/span&gt;
   &lt;span class="nt"&gt;--version&lt;/span&gt;, &lt;span class="nt"&gt;-v&lt;/span&gt;  print the version

COPYRIGHT:
   &lt;span class="o"&gt;(&lt;/span&gt;c&lt;span class="o"&gt;)&lt;/span&gt; 2022 Richard Guay
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;-a&lt;/code&gt; flag will take the &lt;code&gt;value&lt;/code&gt; and put it for the address to which to email. The &lt;code&gt;-s&lt;/code&gt; flage will take the &lt;code&gt;value&lt;/code&gt; and place it in the &lt;code&gt;Subject&lt;/code&gt; field of the email. The &lt;code&gt;-b&lt;/code&gt; flag will take the &lt;code&gt;value&lt;/code&gt; and place it in the body of the email. The &lt;code&gt;mkemail&lt;/code&gt; or &lt;code&gt;me&lt;/code&gt; command will then open the TUI for creating the email. The &lt;code&gt;sendemail&lt;/code&gt; or &lt;code&gt;se&lt;/code&gt; command will take the command line information and send the email directly without using the TUI. The &lt;code&gt;notes&lt;/code&gt; or &lt;code&gt;n&lt;/code&gt; command will open EmailIt to the notes screen. The &lt;code&gt;scriptline&lt;/code&gt; or 'sl' command will open the Scriptline screen. The &lt;code&gt;emailit&lt;/code&gt; or &lt;code&gt;em&lt;/code&gt; command will open the EmailIt screen.&lt;/p&gt;

&lt;p&gt;The TUI looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqkjzcropfreg9ie9eqsh.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqkjzcropfreg9ie9eqsh.gif" alt="EmailIt TUI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have the Default account setup in EmailIt, it will then send your email to that account. The resulting email from the gif video would look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fce0b1pmw5vaxesj71v6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fce0b1pmw5vaxesj71v6h.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your all set to do emails from the commandline!&lt;/p&gt;

</description>
      <category>wails</category>
      <category>svelte</category>
      <category>javascript</category>
      <category>tui</category>
    </item>
    <item>
      <title>Building Bulletin Board</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Sat, 10 Dec 2022 11:53:00 +0000</pubDate>
      <link>https://dev.to/raguay/building-bulletin-board-1hl3</link>
      <guid>https://dev.to/raguay/building-bulletin-board-1hl3</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nt-NGvaH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/koyw70i3fuyf0cp7or8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nt-NGvaH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/koyw70i3fuyf0cp7or8g.png" alt="BulletinBoard" width="706" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My Problem
&lt;/h2&gt;

&lt;p&gt;In my job, I often need some information to stay on top of eveything. I’ve tried may types of stickit notes and other programs, but they all seem to be too large and not easy to script. I also need information from several systems in my home network. Therefore, I created the original &lt;a href="https://github.com/raguay/BulletinBoard-NWJS"&gt;BulletinBoard&lt;/a&gt; in &lt;a href="https://nwjs.io/"&gt;NW.js&lt;/a&gt; that works quite well, but now I need to make it smaller. Also, the old code is kind of hacky. NW.js is a great way to build applications using HTML, CSS, and JavaScript. Since it is so easy to use, I’ve used it to create first pass demo applications. The problem with it is that it’s a full Chrome web browser. For a small application, that is just too much wasted memory. Therefore, I’m doing a full redesign in &lt;a href="https://wails.io/"&gt;Wails&lt;/a&gt; to bring down it’s footprint.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wails
&lt;/h2&gt;

&lt;p&gt;Wails is a &lt;a href="https://go.dev/"&gt;go language&lt;/a&gt; program to create HTML, CSS, and JavaScript applications with a go language backend. It creates really small builds because it uses a system HTML browser that is minimal in size (and therefore, minimal APIs). This allows the program to work on Windows, Linux, and macOS and still have a very small footprint. I’ve converted several of my programs to Wails: &lt;a href="https://github.com/raguay/ModalFileManager"&gt;Modal File Manager&lt;/a&gt;, &lt;a href="https://github.com/raguay/EmailIt"&gt;EmailIt&lt;/a&gt;, and &lt;a href="https://github.com/raguay/ScriptBarApp"&gt;ScriptBar&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In order to get the same functionality with the original BulletinBoard program, I need to have a full web server built in. The orginal version allowed me to do just that with the Node.js backend. Now, I need to figure out how to do the same with go lang and still work with Wails.&lt;/p&gt;

&lt;p&gt;Wails already runs a web server backend (I suspect it is web sockets based) to work with the frontend of the program. Since I can’t piggy back on it, I have to have a separate web server backend. This is necessary since the frontend JavaScript doesn’t support doing a server.  &lt;/p&gt;

&lt;p&gt;The question becomes: Can you run a separate web server on the same go backend?&lt;/p&gt;

&lt;h2&gt;
  
  
  Things Wails Currently Doesn’t Do
&lt;/h2&gt;

&lt;p&gt;While writing this article, Wails 2 is still in development and doesn’t have every feature needed for this application. For instance, it can’t run with the Dock icon not showing and a menubar icon only. Those are still in the works. But, it can control the hiding and showing of the program. It can also make the window always on top. Therefore, most of the functionality is ready for this application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bulletin Board Design
&lt;/h2&gt;

&lt;p&gt;The go language has several backends for running a web server. I’ve decided to use the &lt;a href="https://github.com/gin-gonic/gin"&gt;gin&lt;/a&gt; backend since it is real easy to use and seems to be the most popular one. I’ve only done one project in go before, but it is an easy language to pickup.&lt;/p&gt;

&lt;p&gt;The design is based on an API backend that receives GET requests on the route &lt;code&gt;/api/messages/:message&lt;/code&gt; with the &lt;code&gt;:message&lt;/code&gt; is the message to display. The same message is in the body in JSON format as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;msg:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;message&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where &lt;code&gt;message&lt;/code&gt; is the same text in the web address. It's done this way because of the original design was first based on the web address only, but longer messages needed the body. It is a hack, but it worked and there isn’t time to change everything! Also, a GET request is easy to implement in scripting languages (like using &lt;code&gt;wget&lt;/code&gt; or &lt;code&gt;curl&lt;/code&gt; command line programs).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WbqbpC9c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3qo91zhjz1qoxmmqvv9w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WbqbpC9c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3qo91zhjz1qoxmmqvv9w.png" alt="BulletinBoard Communications" width="880" height="923"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  BulletinBoard Communications - Made with &lt;a href="https://www.onemodel.app"&gt;OneModel&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;The backend receives this request and uses signals to pass it to the frontend. Wails has a great event based message sending framework. The frontend is done using &lt;a href="https://svelte.dev/"&gt;Svelte&lt;/a&gt;. The original was plain JavaScript and HTML and not too pretty (Okay, it was a quick hack). Now, I’m using a nice framework to build a modular system that is easy to expand. &lt;/p&gt;

&lt;p&gt;The original design allowed for dialogs to send back information as well. For this project, I’m just doing the messaging system to see if I can get it to work using Wails and the go language server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s Get Started
&lt;/h2&gt;

&lt;p&gt;To get started, you need to install &lt;a href="https://nodejs.org/en/"&gt;nodejs with npm&lt;/a&gt;,  &lt;a href="https://go.dev/"&gt;go language&lt;/a&gt;, and &lt;a href="https://wails.io/"&gt;Wails 2&lt;/a&gt;. I’m using version 43 of Wails 2 in this article.&lt;/p&gt;

&lt;p&gt;Create a directory for your project and run the following command line to initialize a Wails project with Svelte:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wails &lt;span class="nt"&gt;-n&lt;/span&gt; “BulletinBoard” &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; “svelte&lt;span class="s2"&gt;"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a Svelte frontend Wails project with normal JavaScript. If you want to use TypeScript, use the template “svelte-ts”.&lt;/p&gt;

&lt;p&gt;The first thing is to setup the &lt;code&gt;main.go&lt;/code&gt; file as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"embed"&lt;/span&gt;

    &lt;span class="s"&gt;"github.com/wailsapp/wails/v2"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/wailsapp/wails/v2/pkg/options"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/wailsapp/wails/v2/pkg/options/mac"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;//go:embed frontend/dist&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;assets&lt;/span&gt; &lt;span class="n"&gt;embed&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;FS&lt;/span&gt;

&lt;span class="c"&gt;//go:embed build/appicon.png&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// Create an instance of the app structure&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;NewApp&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c"&gt;// Create application with options&lt;/span&gt;
    &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;wails&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Title&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;             &lt;span class="s"&gt;"BulletinBoard"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;             &lt;span class="m"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Height&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;            &lt;span class="m"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Assets&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;            &lt;span class="n"&gt;assets&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;BackgroundColour&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;  &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RGBA&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;R&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;27&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;G&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;38&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;B&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;54&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="n"&gt;DisableResize&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;     &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Fullscreen&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;        &lt;span class="no"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Frameless&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;         &lt;span class="no"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;StartHidden&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;       &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;AlwaysOnTop&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;       &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;HideWindowOnClose&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;OnStartup&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;         &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;startup&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;OnDomReady&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;        &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;domReady&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;OnShutdown&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;        &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shutdown&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Bind&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="k"&gt;interface&lt;/span&gt;&lt;span class="p"&gt;{}{&lt;/span&gt;
            &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="n"&gt;Mac&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;mac&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Options&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;TitleBar&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;             &lt;span class="n"&gt;mac&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TitleBarHiddenInset&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="n"&gt;Appearance&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;           &lt;span class="n"&gt;mac&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NSAppearanceNameDarkAqua&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;WebviewIsTransparent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;WindowIsTranslucent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;  &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;About&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;mac&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AboutInfo&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;Title&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;   &lt;span class="s"&gt;"BulletinBoard"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"© 2022 Richard Guay &amp;lt;raguay@customct.com&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;Icon&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;    &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Error:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This setups a typical program with transparent backgrounds and hidden on startup. The &lt;code&gt;OnStartup&lt;/code&gt; entry is set to &lt;code&gt;app.startup&lt;/code&gt; which is where we will launch our server. Launching the server at this location will have all the custom code in one place and allows the Wails server for the frontend to be initialized first.&lt;/p&gt;

&lt;p&gt;Next, we need to create our application logic in the &lt;code&gt;app.go&lt;/code&gt; file. Add the following information:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"context"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/gin-gonic/gin”    // webserver framework
    rt "&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;wailsapp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;wails&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;v2&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;pkg&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;runtime&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="c"&gt;// Wails runtime&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"net/url"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// App struct&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;App&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// NewApp creates a new App application struct&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;NewApp&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;domReady&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;shutdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// startup is called when the app starts. The context is saved&lt;/span&gt;
&lt;span class="c"&gt;// so we can call the runtime methods&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;startup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;

    &lt;span class="c"&gt;//&lt;/span&gt;
    &lt;span class="c"&gt;// We need to start the backend and setup the signaling.&lt;/span&gt;
    &lt;span class="c"&gt;//&lt;/span&gt;
    &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;backend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is mostly setup code except for the startup function. The &lt;code&gt;ctx&lt;/code&gt; variable is the context for the whole application and is needed for the server to run. It is passed to the server using the line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;  &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;backend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;go&lt;/code&gt; at the front of the backend function name tells go to run the server as a go coroutine. This runs on a separate thread that doesn’t interfere with the other frontend code. This allows the server to run without bothering anything else and makes this project functional.&lt;/p&gt;

&lt;p&gt;Then add the following to the bottom of the &lt;code&gt;app.go&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Msg&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Message&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="s"&gt;`json:"msg" xml:"user"  binding:"required"`&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;backend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;//&lt;/span&gt;
    &lt;span class="c"&gt;// This will have the web server backend for BulletinBoard.&lt;/span&gt;
    &lt;span class="c"&gt;//&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;gin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Default&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Recovery&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="c"&gt;//&lt;/span&gt;
    &lt;span class="c"&gt;// Define the message route. The message is given on the URI string and in the body.&lt;/span&gt;
    &lt;span class="c"&gt;//&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/api/message/:message"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;gin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusOK&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;H&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s"&gt;"msg"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"okay"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;})&lt;/span&gt;
        &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt; &lt;span class="n"&gt;Msg&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ShouldBindJSON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusBadRequest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;H&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"error"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;()})&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;messageBody&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;messageBody&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;messageBody&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;QueryUnescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c"&gt;// An error in decoding.&lt;/span&gt;
            &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="c"&gt;//&lt;/span&gt;
        &lt;span class="c"&gt;// Send it to the frontend.&lt;/span&gt;
        &lt;span class="c"&gt;//&lt;/span&gt;
        &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EventsEmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="c"&gt;//&lt;/span&gt;
    &lt;span class="c"&gt;// Run the server.&lt;/span&gt;
    &lt;span class="c"&gt;//&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;":9697"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a basic setup for a single route in the gin web server framework. It is very basic right now, but very functional. I need to add middleware that does security checking to make the program more secure. But, we just want to demostrate that this approach is possible.&lt;/p&gt;

&lt;p&gt;The function for the route gets the message from the URI and the body JSON structure. It then decodes it from URI encoding and checks to see if they are the same. If so, just send on the one from the URL. Otherwise, it sends the one from the body.&lt;/p&gt;

&lt;p&gt;The interesting part is the next line that uses Wails runtime &lt;code&gt;rt.EventsEmit()&lt;/code&gt; function to tell the frontend that we have a new message to display. The event has the name “message” that the frontend will receive and setup for displaying a message. This is important for expanding for other types in the future.&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;frontend/src/main.js&lt;/code&gt; file, add this information:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;BulletinBoard&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./BulletinBoard.svelte&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;BulletinBoard&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;BulletinBoard&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is simple boilerplate code for starting a Svelte application. The &lt;code&gt;BulletinBoard.svelte&lt;/code&gt; file is the main program. &lt;/p&gt;

&lt;p&gt;Now for the main program.  Create the &lt;code&gt;BulletinBoard.svelte&lt;/code&gt; file with the &lt;code&gt;frontend/src&lt;/code&gt; directory with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;onMount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;afterUpdate&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;svelte&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Message&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/Message.svelte&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./stores/state.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./stores/theme.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./stores/message.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;rt&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../wailsjs/runtime/runtime.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// the runtime for Wails2&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;containerDOM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;minWidth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;minHeight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nx"&gt;onMount&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;$state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;nothing&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;getTheme&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="c1"&gt;// Set a function to run when a event (signal) is sent from the webserver.&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="nx"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;EventsOn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//&lt;/span&gt;
        &lt;span class="c1"&gt;// Set the message state and save the message in the store.&lt;/span&gt;
        &lt;span class="c1"&gt;//&lt;/span&gt;
        &lt;span class="nx"&gt;$state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;//&lt;/span&gt;
        &lt;span class="c1"&gt;// Show window in case it's off.&lt;/span&gt;
        &lt;span class="c1"&gt;//&lt;/span&gt;
        &lt;span class="nx"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;WindowShow&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//&lt;/span&gt;
        &lt;span class="c1"&gt;// An empty message send by having just a space turns off the BulletinBoard.&lt;/span&gt;
        &lt;span class="c1"&gt;//&lt;/span&gt;
        &lt;span class="nx"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;WindowHide&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="nx"&gt;afterUpdate&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="c1"&gt;// The nothing state should force a window hiding.&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$state&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;nothing&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;WindowHide&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="c1"&gt;// Figure out the width and height of the new canvas.&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;containerDOM&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;minWidth&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;minHeight&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;containerDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientHeight&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;containerDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientHeight&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;containerDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientWidth&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;containerDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientWidth&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;WindowSetSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getTheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="c1"&gt;// This would read the theme from a file. It currently just sets a typical theme.&lt;/span&gt;
    &lt;span class="c1"&gt;// I love the Dracula color theme.&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="nx"&gt;$theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Fira Code, Menlo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;fontSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;12pt&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;textAreaColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#454158&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#22212C&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;textColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#80ffea&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;borderColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#1B1A23&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;Cyan&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#80FFEA&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;Green&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#8AFF80&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;Orange&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#FFCA80&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;Pink&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#FF80BF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;Purple&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#9580FF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;Red&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#FF9580&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;Yellow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#FFFF80&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt;
  &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;“closure"&lt;/span&gt;
  &lt;span class="na"&gt;bind:this=&lt;/span&gt;&lt;span class="s"&gt;{containerDOM}&lt;/span&gt;
  &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"background-color: {$theme.backgroundColor}; color:    
  {$theme.textColor}; font-family: {$theme.font}; font-size: 
  {$theme.fontSize};"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"header"&lt;/span&gt; &lt;span class="na"&gt;data-wails-drag&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Bulletin Board&lt;span class="nt"&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"main"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    {#if $state === "message"}
      &lt;span class="nt"&gt;&amp;lt;Message&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    {/if}
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
  &lt;span class="nd"&gt;:global&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;transparent&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;transparent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;#closure&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;#header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;-webkit-user-select&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="py"&gt;user-select&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;default&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;#main&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nt"&gt;h3&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;default&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="n"&gt;em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;onMount&lt;/code&gt; function tells Svelte compiler to run the code while mounting this component. This code initializes the theme stored in the &lt;code&gt;$theme&lt;/code&gt; state store. The function then sets up the event receiver to receive “message” events using the &lt;code&gt;rt.EventsOn&lt;/code&gt; function. When it gets a message, it sets the $message store variable to it and sets the $state store variable to “message”. This tells the HTML code to show the &lt;code&gt;Message&lt;/code&gt; component and show the window using &lt;code&gt;rt.ShowWindow()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;bind:this={containerDOM}&lt;/code&gt; will put the DOM node into the variable &lt;code&gt;containerDOM&lt;/code&gt;. This can then be queried to find out information about the &lt;code&gt;div&lt;/code&gt; node that contains the message. &lt;/p&gt;

&lt;p&gt;The next interesting bit of code is in the &lt;code&gt;afterUpdate&lt;/code&gt; function call. This sets a function to call after all components are setup and visible. In this one,  it first sets the window to hidden if the state equals “nothing”. Therefore, it creates an easy way to hide the window from anywhere simply by setting the state variable. Secondly, it uses the &lt;code&gt;containerDOM&lt;/code&gt; variable to adjust the window size based on the application &lt;code&gt;div&lt;/code&gt; size. It also keeps it from getting too small.&lt;/p&gt;

&lt;p&gt;The rest of the code simply sets up the HTML and CSS for creating the main window. Now, we can go on to the Message component.&lt;/p&gt;

&lt;p&gt;Now create the &lt;code&gt;frontend/src/components/&lt;/code&gt; directory and create the &lt;code&gt;Message.svelte&lt;/code&gt; file with this information:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../stores/message.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"message"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;{$message}&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
  &lt;span class="nf"&gt;#message&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an easy component since it just displays a message. You might be thinking that I’m showing unsantitize user given information in the HTML with the line &lt;code&gt;{$message}&lt;/code&gt;. The brackets tell Svelte to get the result of the JavaScript expression, santitize it, and display it. Here, we are displaying the information in the $message store variable. Since Svelte does the sanitizing, I don’t have to worry about it.&lt;/p&gt;

&lt;p&gt;This looks very trivial to make a full component, but this is modular design. I just add more components for doing different types of displaying. The other display types will have much more code in them.&lt;/p&gt;

&lt;p&gt;The remaining parts are the different Svelte stores used in this project. The different stores are in the directory &lt;code&gt;frontend/src/stores&lt;/code&gt; and can seen in the GitHub &lt;a href="https://github.com/raguay/BulletinBoard"&gt;BulletinBoard&lt;/a&gt; project page. This is an ongoing project and this repro reflects that with more functionality being written each week….well, when I have time for them.&lt;/p&gt;

&lt;p&gt;The application is built with the command line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wails build &lt;span class="nt"&gt;--platform&lt;/span&gt; &lt;span class="s2"&gt;"darwin/universal”
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which creates a macOS universal binary and bundles it all up in an application bundle called &lt;code&gt;BulletinBoard.app&lt;/code&gt; in the &lt;code&gt;build/bin&lt;/code&gt; directory. &lt;/p&gt;

&lt;p&gt;If you aren’t on a macOS system, then just use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wails build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the application is ran, a requester dialog asking if you want it to allow the program to accept incoming network connections will appear (macOS only). Simply allow it and the program is running. But wait, nothing shows up. That is because the application was started in the hidden state. In order for the program to become visible, it has to receive a message request.&lt;/p&gt;

&lt;p&gt;In order to send messages to it, you have to create a message sending program. This is done with a small ruby script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/usr/bin/env ruby&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'net/http'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'json'&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;uri_encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gsub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;URI&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;UNSAFE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each_byte&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nb"&gt;sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'%%%02X'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ord&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="no"&gt;ARGV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;'-'&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
  &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;uri_encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;ARGV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="n"&gt;uri&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;URI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"http://localhost:9697/api/message/&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;http&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Net&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;host&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;port&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Net&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Content-Type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'application/json'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;msg: &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;to_json&lt;/span&gt;
&lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"response &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;”
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you put this in a file named ‘sendmsg’ and set it to executable, you can type the following command line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sendmsg “hello”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The BulletinBoard application will show up like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nt-NGvaH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/koyw70i3fuyf0cp7or8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nt-NGvaH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/koyw70i3fuyf0cp7or8g.png" alt="BulletinBoard.png" width="706" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This tutorial just proved that there can be multiple web servers inside of a single Wails application thanks to the go language's use of coroutines. This works great and now I can finish the other functions. I want to be able to display script supplied dialogs to the user and return JSON data structure with the results. &lt;/p&gt;

&lt;p&gt;If your interested in keeping up with this project or simply want to download the source yourself, you can find it on the GitHub page for &lt;a href="https://github.com/raguay/BulletinBoard"&gt;BulletinBoard&lt;/a&gt;. It already doesn’t look like it does here since it is an ongoing project. It has a &lt;a href="https://github.com/raguay/BulletinBoard/discussions"&gt;discussion board&lt;/a&gt; for asking questions or just to comment on it.&lt;/p&gt;

&lt;p&gt;On to the next steps!&lt;/p&gt;

&lt;p&gt;Note: The article picture is from &lt;a href="https://elements.envato.com/"&gt;Envato Elements&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>wails</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>EmailIt First Release!</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Wed, 10 Aug 2022 07:02:31 +0000</pubDate>
      <link>https://dev.to/raguay/emailit-first-release-4a21</link>
      <guid>https://dev.to/raguay/emailit-first-release-4a21</guid>
      <description>&lt;p&gt;This is just to let everyone know that I just released the first version of the &lt;a href="https://github.com/raguay/EmailIt"&gt;EmailIt&lt;/a&gt; program. The documentation isn't all there, but the program works. I use it everyday on my computer. It is built as a macOS universal build. It is built using Wails, and Svelte.&lt;/p&gt;

&lt;p&gt;It’s a handy little markdown based email sending only program with nine notepads, scripts to manipulate the text, and templates. It also has a script terminal with minimal commands, a bundled Node-Red server, and the &lt;a href="https://github.com/raguay/ScriptBarApp"&gt;ScriptBar&lt;/a&gt; program.&lt;/p&gt;

&lt;p&gt;Give it a try and let me know how you like it in the &lt;a href="https://github.com/raguay/EmailIt/discussions"&gt;discussions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>wails</category>
      <category>email</category>
      <category>scripts</category>
    </item>
    <item>
      <title>First Release of the New Modal File Manager</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Thu, 31 Mar 2022 05:40:21 +0000</pubDate>
      <link>https://dev.to/raguay/first-release-of-the-new-modal-file-manager-3bfj</link>
      <guid>https://dev.to/raguay/first-release-of-the-new-modal-file-manager-3bfj</guid>
      <description>&lt;p&gt;I’ve just released the first version of the new Modal File Manager for the macOS. It is built using &lt;a href="https://wails.io/"&gt;Wails 2&lt;/a&gt; and &lt;a href="https://svelte.dev/"&gt;Svelte&lt;/a&gt;. It is a complete universal application that should work on Intel and M1 Macs. I’ve been develping and using it on my M1 MacBook Pro for several weeks now. I use it as my main file manager everyday.&lt;/p&gt;

&lt;p&gt;If you have a problem, please leave an &lt;a href="https://github.com/raguay/ModalFileManager/issues"&gt;issue&lt;/a&gt; so that I can track it down and fix it. I haven’t built it on a Linux or Windows system. Therefore, I’m not sure how well it will do there. &lt;/p&gt;

&lt;p&gt;You can read the annoucement &lt;a&gt;here&lt;/a&gt; and download the program &lt;a href="https://github.com/raguay/ModalFileManager/releases/tag/V1.0.2"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Currently, the only documentation is the GitHub README.md file. You can read it &lt;a href="https://github.com/raguay/ModalFileManager"&gt;here&lt;/a&gt;. I’ll be working on better documentation soon.&lt;/p&gt;

</description>
      <category>mfm</category>
      <category>wails2</category>
      <category>svelte</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Modal File Manager: Update and Extensions</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Thu, 01 Jul 2021 04:34:19 +0000</pubDate>
      <link>https://dev.to/raguay/modal-file-manager-update-and-extensions-2kb5</link>
      <guid>https://dev.to/raguay/modal-file-manager-update-and-extensions-2kb5</guid>
      <description>&lt;p&gt;I recently wrote an update to my &lt;a href="https://github.com/raguay/ModalFileManager"&gt;Modal File Manager project&lt;/a&gt; called &lt;a href="https://blog.customct.com/modal-file-manager-update-and-extensions"&gt;Modal File Manager: Update and Extensions&lt;/a&gt;. It goes into many new features that I've added to the Modal File Manager, how to install the macOS version that I bundled for downloading, and all the themes and extensions that I've created for the Modal File Manager. &lt;/p&gt;

&lt;p&gt;I hope you enjoy this fun little project and decide to help me in the journey to create a very powerful, dual file pane file manager together!&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>nwjs</category>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>My Latest Side Project: Modal File Manager</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Mon, 12 Apr 2021 04:19:54 +0000</pubDate>
      <link>https://dev.to/raguay/my-latest-side-project-modal-file-manager-3og5</link>
      <guid>https://dev.to/raguay/my-latest-side-project-modal-file-manager-3og5</guid>
      <description>&lt;p&gt;On my &lt;a href="https://blog.customct.com/"&gt;blog site&lt;/a&gt;, I just added a post about my latest side project: &lt;a href="https://blog.customct.com/my-side-project-modal-file-manager"&gt;Modal File Manager&lt;/a&gt;. It is a two pane file manager with a twist: it uses state based key mapping just like Vim!&lt;/p&gt;

&lt;p&gt;It is a new project that is currently in Alpha stage. You can download from my &lt;a href="https://github.com/raguay/ModalFileManager"&gt;GitHub account&lt;/a&gt; and play with it. It is built using &lt;a href="https://svelte.dev"&gt;Svelte&lt;/a&gt;, &lt;a href="https://nwjs.io/"&gt;Nw.js&lt;/a&gt;, and &lt;a href="https://github.com/jakedeichert/mask"&gt;mask script running&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I’m looking for people to help with the project. It is an open source project, so jump right in. At least let me know what you think and any suggestions you might have.&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>nwjs</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>Controling your Computer from a Phone</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Fri, 15 Jan 2021 10:47:17 +0000</pubDate>
      <link>https://dev.to/raguay/controling-your-computer-from-a-phone-22ai</link>
      <guid>https://dev.to/raguay/controling-your-computer-from-a-phone-22ai</guid>
      <description>&lt;p&gt;A little while ago, someone asked what can be done with a older tablet or phone. I mentioned that you could control your computer with one. I’ve been doing it for a while with my Huawei phone or my Kindle Fire using a local web server on my computer. The person, I don’t remember who or on what forum we were talking, asked me to share it. Well, it was embedded deeply in another project. But, I decided to extract it and make it available.&lt;/p&gt;

&lt;p&gt;Well, it is done and available &lt;a href="https://github.com/raguay/SvelteScriptServer"&gt;on my GitHub account&lt;/a&gt;. Feel free to download, expand upon it, and just have fun. If you add something interesting or just neat, send a pull request. It’s current state is far from ideal. You have to change the code to configure the buttons right now, but it gives a good idea of what you can do.&lt;/p&gt;

&lt;p&gt;Word of Caution: it doesn’t have great security right now. I will be looking into adding that soon. In the meantime, I recommend only using it in a trusted and secure local network.&lt;/p&gt;

&lt;h2&gt;
  
  
  File Organization
&lt;/h2&gt;

&lt;p&gt;At the top level, there are three things: the server directory, the UI directory, and a &lt;code&gt;maskfile.md&lt;/code&gt; file for using &lt;a href="https://github.com/jakedeichert/mask"&gt;mask&lt;/a&gt;. Mask is a great tool for running scripts on your project. I use it all the time.&lt;/p&gt;

&lt;p&gt;The server directory has all the code for running the local Express.js server. You should not need to edit this file unless you are adding new features to the backend (like security).&lt;/p&gt;

&lt;p&gt;The UI directory contains most of the code. Here, you can edit the tiles displayed and the actions they perform. This code is written in &lt;a href="https://svelte.dev/"&gt;Svelte&lt;/a&gt; for speed and small foot print. Svelte is a great framework for writing Single Page Applications (SPA). &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;UI/src&lt;/code&gt; directory contains all the files for creating the user interface. The  &lt;code&gt;UI/src/main.js&lt;/code&gt; file contains all non-Svelte code. Every other file is written in Svelte and has the &lt;code&gt;.svelte&lt;/code&gt; extension.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;UI/src/main.js&lt;/code&gt; file contains the structures you will want to change to add more buttons and change the theming.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding/Removing Buttons
&lt;/h2&gt;

&lt;p&gt;The heart of the program is the &lt;code&gt;scriptList&lt;/code&gt; structure. This is a two dimensional array of objects that define a tile (the button you press to evoke a program or script). The row of tiles is an array of those objects. So, to add a new row or remove a row, add or remove an array. &lt;/p&gt;

&lt;p&gt;The tile object is of the following format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;name:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Open fman"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;description:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Open a copy of the fman program."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;script:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/Applications/fman.app/Contents/SharedSupport/bin/fman"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;args:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;'&amp;amp;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;color:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"lightgreen"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;textColor:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"darkgreen"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;height:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"70px"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;width:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"30%"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;name&lt;/code&gt; is the name of the tile, &lt;code&gt;description&lt;/code&gt; describes what action the tile performs, &lt;code&gt;program&lt;/code&gt; is the program or script to run, &lt;code&gt;args&lt;/code&gt; is an array of command line arguments used to run the command, &lt;code&gt;color&lt;/code&gt; is the background color for the tile, &lt;code&gt;textColor&lt;/code&gt; is the color for the text in the tile, &lt;code&gt;height&lt;/code&gt; is the height of the tile, and &lt;code&gt;width&lt;/code&gt; is the width of the tile. When describing the height or width, you can use percentages or fixed numbers in pixel, rem, or any other CSS measurement standard. When specifying the height, don’t use percentage as that will be the percentage of the row that it is on.&lt;/p&gt;

&lt;p&gt;When you run a program, it will use the environment that the server is launched. If you launch the server in the root environment, then your programs will have the privileges and environment variables of that environment. Therefore, be very careful! I only run it in my own login. But, if it automatically launches in a startup script, then it will have the environment of the startup script that doesn’t always match your normal environment. Alfred users run into this issue often.&lt;/p&gt;

&lt;p&gt;The only other interesting structure is the &lt;code&gt;styles&lt;/code&gt; structure that controls the look of the background of the web page. Only two things can be currently configured: backgroundColor and textColor. These are very self explanatory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running the Server
&lt;/h2&gt;

&lt;p&gt;While in the top directory where the &lt;code&gt;mask file.md&lt;/code&gt; file is, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mask LaunchServer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This only works if you have the mask taskrunner on your computer. This command will compile the UI code and launch the Express.js server. Now open a web browser to &lt;code&gt;http://localhost:3000&lt;/code&gt; and you will see the main page.&lt;/p&gt;

&lt;p&gt;In the upper right corner is a button labeled &lt;code&gt;Show QR Code&lt;/code&gt;.  By clicking this button, a QR code will be displayed. Scan that code with your mobile device and open the given web address in your browser. You will see the same page without the &lt;code&gt;Show QR Code&lt;/code&gt; button. You are now setup to launch programs on your computer from your phone or tablet!&lt;/p&gt;

&lt;p&gt;By clicking the QR code on your computer, it will go away. Same with clicking the button again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Now that you know about this software, play with it and let me know how you use it. If you add something useful, send a pull request. Above all, have fun!&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>automation</category>
      <category>express</category>
    </item>
    <item>
      <title>A Corvid-19 Widget for the Plash Server</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Fri, 20 Mar 2020 15:08:55 +0000</pubDate>
      <link>https://dev.to/raguay/a-corvid-19-widget-for-the-plash-server-45nh</link>
      <guid>https://dev.to/raguay/a-corvid-19-widget-for-the-plash-server-45nh</guid>
      <description>&lt;p&gt;Well, with all the noise about the Corvid-19 virus, I decided to make a widget that works with my &lt;a href="https://sindresorhus.com/plash"&gt;Plash&lt;/a&gt; &lt;a href="http://customct.com/#/blog/plashserver-series"&gt;server project&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have a full tutorial series on my &lt;a href="http://customct.com/#/blog/plashserver-series"&gt;personal blog site&lt;/a&gt;. My latest tutorial is &lt;a href="http://www.customct.com/#/tutorials/plashserver/covid19widget"&gt;a Corvid-19 widget&lt;/a&gt; and a Text widget. This widget will show the current infection rate for any country you are interestd in. On my background, it shows for Thailand (where I live) and the USA (where I’m from).&lt;/p&gt;

&lt;p&gt;This series assumes you know very little about Svelte. I am trying to use it as a way to get more people interested in Svelte framework and know how to use if for their needs. I think it makes a great playground to learn Svelte.&lt;/p&gt;

&lt;p&gt;I would love to see your comments on this series. All code is located on my &lt;a href="https://github.com/raguay/SveltePlashServer"&gt;GitHub repository for the PlashServer&lt;/a&gt;. Fork it, expand it, and send me some pull requests. It would be a lot of fun to have a community contributing to this project.&lt;/p&gt;

</description>
      <category>corvid19</category>
      <category>svelte</category>
      <category>plash</category>
    </item>
    <item>
      <title>Adding an Exchange Rate Display to the PlashServer</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Mon, 02 Mar 2020 09:08:28 +0000</pubDate>
      <link>https://dev.to/raguay/adding-an-exchange-rate-display-to-the-plashserver-51kn</link>
      <guid>https://dev.to/raguay/adding-an-exchange-rate-display-to-the-plashserver-51kn</guid>
      <description>&lt;p&gt;I’m one of those people that love to control what’s on the background of my computer. I’ve used many widget tools to perform these tasks, but they all left me as under developed, hacky at times, and not as easy to use as I would like. That’s most likely because I never took the time to really get into their code structures. But, when you create your own thing, then you know it very well.&lt;/p&gt;

&lt;p&gt;When the &lt;a href="https://sindresorhus.com/plash"&gt;Plash&lt;/a&gt; program came out for the macOS, I jump right onto it. It allows you to put any website, whether a local file system one or one served on the net, as your background. That directly inspired me to create a &lt;a href="https://svelte.dev"&gt;Svelte&lt;/a&gt; based background webpage for Plash.&lt;/p&gt;

&lt;p&gt;I have a full tutorial series on my &lt;a href="http://customct.com/#/blog/plashserver-series"&gt;personal blog site&lt;/a&gt;. The &lt;a href="http://www.customct.com/#/tutorials/plashserver/plashserversetup"&gt;first tutorial&lt;/a&gt; takes you through the building of the basic framework and getting everything running with Plash. The initial widgets are a circular time display with the actual time under it.&lt;/p&gt;

&lt;p&gt;My latest tutorial is &lt;a href="http://www.customct.com/#/tutorials/plashserver/exchangewidget"&gt;an Exchange Rate widget&lt;/a&gt;. This widget will show the current exchange rate for whatever currency your interested in seeing. Since it’s a widget, you can add it onto your screen as many times as you like. This tutorial really shows how to make use of promises in the Svelte framework.&lt;/p&gt;

&lt;p&gt;This series assumes you know very little about Svelte. I am trying to use it as a way to get more people interested in Svelte framework and know how to use if for their needs. I think it makes a great playground to learn Svelte.&lt;/p&gt;

&lt;p&gt;I would love to see your comments on this series. All code is located on my &lt;a href="https://github.com/raguay/SveltePlashServer"&gt;GitHub repository for the PlashServer&lt;/a&gt;. Fork it, expand it, and send me some pull requests. It would be a lot of fun to have a community contributing to this project.&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>plash</category>
      <category>background</category>
    </item>
    <item>
      <title>Using the Svelte GitHub Website Template</title>
      <dc:creator>Richard Guay</dc:creator>
      <pubDate>Tue, 31 Dec 2019 09:20:00 +0000</pubDate>
      <link>https://dev.to/raguay/using-the-svelte-github-website-template-1ca1</link>
      <guid>https://dev.to/raguay/using-the-svelte-github-website-template-1ca1</guid>
      <description>&lt;h4&gt;
  
  
  Originally posted on 2019-12-06 at &lt;a href="http://www.customct.com/#/tutorials/svelteweb/using-template"&gt;Custom Computer Tools&lt;/a&gt;.
&lt;/h4&gt;

&lt;p&gt;Many want to run a simple blog or a small website without spending a whole lot of money. They often believe they have to sacrifice speed and flexibility to get it going cheap enough for them. But, the truth is, you can create a website for free!&lt;/p&gt;

&lt;p&gt;This tutorial will show you how you can create your own website with simple markdown files and a &lt;a href="https://pages.github.com/"&gt;GitHub Pages&lt;/a&gt; account. You are going to build a site using the &lt;a href="https://svelte.dev/"&gt;Svelte framework&lt;/a&gt; and the &lt;a href="https://github.com/raguay/SvelteGithubSiteTemplate"&gt;Svelte GitHub Website Template&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This template creates everything you need to get a working website going on your computer, and then putting it on the web using &lt;a href="https://GitHub.com"&gt;GitHub&lt;/a&gt;. Since it is basically a flat file system website, you will not need to install a full web server stack. The Svelte installation supplies a Node.js based development server with live&lt;br&gt;
reload to view your site as you are building it.&lt;/p&gt;

&lt;p&gt;This template has partials for taking pieces of code and placing it in your site where ever you need it in the markdown pages. It also has a macro expansion ability based on &lt;a href="https://handlebarsjs.com/"&gt;Handlebars&lt;/a&gt; with some added helpers that I've designed. Since your pages are created using &lt;a href="https://daringfireball.net/projects/markdown/basics"&gt;markdown&lt;/a&gt;, it would be good to become familiar with how it works.&lt;/p&gt;
&lt;h2&gt;
  
  
  Tools you will need
&lt;/h2&gt;

&lt;p&gt;You will need to have &lt;a href="https://nodejs.org/en/"&gt;Node.js&lt;/a&gt;, &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"&gt;git&lt;/a&gt;, &lt;a href="https://github.com/jakedeichert/mask"&gt;Mask&lt;/a&gt; task runner, a web browser, and a text editor. You don't have to have Mask, but I do highly recommend using it. I'm personally using the &lt;a href="https://v2.onivim.io/"&gt;Oni 2&lt;/a&gt; editor for writing and programming, but you can use any editor that you are used to using.&lt;/p&gt;

&lt;p&gt;I'm working on a macOS system, but any computer system that can run the above tools should work fine. If you are on windows, you might need to use the &lt;a href="https://github.com/egoist/maid"&gt;Maid&lt;/a&gt; task runner instead. Mask is a Rust program and hasn't been tested on Windows much, but Maid is a Node.js program and should run anywhere that Node.js runs. I will show you all the steps for making your own scripts if you don't want to use a script runner.&lt;/p&gt;
&lt;h2&gt;
  
  
  Downloading the Template and Running the Development Server
&lt;/h2&gt;

&lt;p&gt;In a terminal program, like &lt;a href="https://github.com/kovidgoyal/kitty"&gt;Kitty&lt;/a&gt;, go to the directory you would like your website directory. In that directory, run the following command line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
npx degit raguay/SvelteGithubSiteTemplate &amp;lt;project name&amp;gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; &amp;lt;project name&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;&amp;lt;project name&amp;gt;&lt;/code&gt; is the name you give your website. Therefore, if you want the directory for your website to be called &lt;code&gt;MyBlog&lt;/code&gt;, then use &lt;code&gt;MyBlog&lt;/code&gt; instead of &lt;code&gt;&amp;lt;project name&amp;gt;&lt;/code&gt;. The above command lines become:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx degit raguay/SvelteGithubSiteTemplate MyBlog
&lt;span class="nb"&gt;cd &lt;/span&gt;MyBlog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you are in the website directory. The website directory should have a directory/file structure as shown (tree is a unix command for showing the current directory down in a graphical tree structure):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nv"&gt;$ &lt;/span&gt;tree
├── LICENSE
├── README.md
├── launch
│  ├── README.md
│  ├── css
│  │  └── bundle.css
│  ├── index.html
│  └── js
│      └── bundle.js
├── maskfile.md
├── package.json
├── public
│  ├── CNAME
│  ├── bundle.css
│  ├── bundle.css.map
│  ├── bundle.js
│  ├── bundle.js.map
│  ├── index.html
│  └── site
│      ├── 404.md
│      ├── blog
│      │  ├── index.md
│      │  └── my-first-post.md
│      └── parts
│          └── test.html
├── rollup.config.js
└── src
    ├── WebSite.svelte
    ├── components
    │  ├── About.svexy
    │  ├── BlogPosts.svelte
    │  ├── Footer.svelte
    │  ├── Index.svexy
    │  ├── Logo.svelte
    │  ├── NavBar.svelte
    │  ├── Page.svelte
    │  ├── Sidebar.svelte
    │  └── Twitter.svelte
    ├── main.js
    └── store
        └── infoStore.js

10 directories, 31 files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, run the npm command to install the node.js libraries needed to work on this website:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This takes a while if you've never installed some of the node.js packages. On my system, it took 44 seconds. Once done, you can now run the development server and see what your website looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you see the &lt;code&gt;waiting for changes...&lt;/code&gt; in the terminal, your site has been compiled and is running on a local server. You can open a browser and view your site at &lt;code&gt;http://localhost:5000&lt;/code&gt;. The local server puts code into your site to auto refresh your browser whenever you change any file in the &lt;code&gt;src&lt;/code&gt; directory. When you do, it will recompile the code and force a refresh on your browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Two Types of Pages
&lt;/h2&gt;

&lt;p&gt;There are two types of pages in this template: a Svelte component and markdown files. In the current site, the &lt;code&gt;About.svexy&lt;/code&gt; and &lt;code&gt;Index.svexy&lt;/code&gt; components are for the main site index page (ie: the front page of your website), and the about page. These can be any valid Svelte component. In this template, they are markdown files that use &lt;a href="https://github.com/pngwn/MDsveX"&gt;Mdsvex&lt;/a&gt;. Mdsvex is a markdown type file that is compiled into a normal Svelte component and added to the &lt;code&gt;bundle.js&lt;/code&gt; file. Therefore, these pages are always loaded into the browser of the person looking at your site. You should keep these types of pages as minimal as possible to keep your load time as fast as possible.&lt;/p&gt;

&lt;p&gt;To see the minimal code for one of these pages, look at the &lt;code&gt;About.svexy&lt;/code&gt; file in the &lt;code&gt;src/components&lt;/code&gt; directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;\`\`\`js exec
  import { fade } from 'svelte/transition';
  import { onMount } from 'svelte';
  import { info } from '../store/infoStore.js';

  onMount(() =&amp;gt; {
    //
    // Subscribe to the information store to get the site information.
    //
    const unsubscribeInfo = info.subscribe((value) =&amp;gt; {
    });

    return () =&amp;gt; { unsubscribeInfo(); };
  });


\`\`\`

\`\`\`css style
  .box {
    width: 100%;
    margin: auto;
    padding: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
  }
\`\`\`

&amp;lt;div class="box" style="border: {$info.styles.borderSize} solid {$info.styles.borderColor}; 
                        border-radius: {$info.styles.borderRadius}; 
                        background-color: {$info.styles.divColor};
                        background-image: {$info.styles.divBackgroundPicture};
                        color: {$info.styles.textColor};" in:fade="{{duration: 500}}"&amp;gt;

## About Us

This is a markdown file with information about you. Change as you see fit.

The `div` setup the proper styling for the markdown and controls the animation of it on the site. Therefore, leave the div information as it is and just change the markdown in between.

&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are two code blocks that the Mdsevx package will include in the module as JavaScript and CSS. The &lt;code&gt;js exec&lt;/code&gt; code block is added as JavaScript to the created Svelte code and the &lt;code&gt;css style&lt;/code&gt; is added to the Svelte CSS block. &lt;strong&gt;Note:&lt;/strong&gt; The extra back slashes are for allowing this website editor to show the back ticks. They are not in the actual file. Anyone know a better way to do this?&lt;/p&gt;

&lt;p&gt;The style block sets the styling for the &lt;code&gt;div&lt;/code&gt; element to show it properly on the site. The JavaScript section loads the Svelte code needed to get the styling information from the &lt;code&gt;info&lt;/code&gt; store and the fade directive for the &lt;code&gt;div&lt;/code&gt; block. Just add the markdown you want in the area between the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/div&amp;gt;&lt;/code&gt; elements.&lt;/p&gt;

&lt;p&gt;If you want to include other components, just load them in the JavaScript section just like any other Svelte component and put the markup in the place you want it to be in the markdown. Just like standard markdown, you can mix in HTML code as needed. This makes for a very versatile  page creation. Anything you want to do can be done in these pages!&lt;/p&gt;

&lt;p&gt;The other type of page is the markdown pages. They are any page under the &lt;code&gt;site&lt;/code&gt; directory in the &lt;code&gt;public&lt;/code&gt; and &lt;code&gt;launch&lt;/code&gt; folders. Any page request that doesn't match a Svelte component in the router is expected to have a corresponding markdown file. For example, the page &lt;code&gt;localhost:5000/blog/index&lt;/code&gt; will send the file &lt;code&gt;public/site/blog/index.md&lt;/code&gt; to the user to see.&lt;/p&gt;

&lt;p&gt;If a file request is sent that doesn't match a component or a markdown file in the system, then the &lt;code&gt;public/site/404.md&lt;/code&gt; file will be processed and sent to the viewer. This file is actually preloaded when the partials are preloaded. You will see how to load partials in the next section.&lt;/p&gt;

&lt;p&gt;These markdown files are limited to plain markdown, any registered Handlebars helpers, and everything that is in the YAML header is available as a Handlebar helper. Here are a list of helpers I've added to the template:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Helper&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{save &amp;lt;name&amp;gt; &amp;lt;text&amp;gt;}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;This command creates a helper named &lt;code&gt;&amp;lt;name&amp;gt;&lt;/code&gt; with the expanding text of &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt;. It also places the given &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; at the point of definition. This allows you to create text snippets on the fly inside the template. Very handy.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{date &amp;lt;format&amp;gt;}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;This will format the current date and time as per the format string given.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cdate &amp;lt;date/time&amp;gt; &amp;lt;format&amp;gt;}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;This takes the date/time string and formats it according to the format given.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{last &amp;lt;weeks&amp;gt; &amp;lt;dow&amp;gt; &amp;lt;fmat&amp;gt;}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;This will go back in time to &lt;code&gt;&amp;lt;weeks&amp;gt;&lt;/code&gt; ago and give the date for the particular &lt;code&gt;&amp;lt;dow&amp;gt;&lt;/code&gt; (Day Of Week) in the &lt;code&gt;&amp;lt;fmat&amp;gt;&lt;/code&gt; format.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{next &amp;lt;weeks&amp;gt; &amp;lt;dow&amp;gt; &amp;lt;fmat&amp;gt;}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;This will go forward in time to &lt;code&gt;&amp;lt;weeks&amp;gt;&lt;/code&gt; ahead and give the date for the particular &lt;code&gt;&amp;lt;dow&amp;gt;&lt;/code&gt; (Day Of Week) in the &lt;code&gt;&amp;lt;fmat&amp;gt;&lt;/code&gt; format.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cDateMDY}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Month Day, 4-digit year format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cDateDMY}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Day Month 4-digit Year format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cDateDOWDMY}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Day of Week, Day Month 4-digit year format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cDateDOWMDY}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Day of Week Month Day, 4-digit year format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cDay}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Day format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cMonth}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Month format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cYear}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in 4-digit year format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cMonthShort}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Short Month name format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cYearShort}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in 2-digit year format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cDOW}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Day of Week format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cMDthYShort}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Month day 2-digit year format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cMDthY}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in Month Day 4-digit year format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cHMSampm}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in h:mm:ss a format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cHMampm}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in h:mm a format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cHMS24}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in H:mm:ss 24 hour format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{{cHM24}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;gives the current date in H:mm 24 hour format&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The time formatting is done using the &lt;a href="https://momentjs.com/"&gt;Moment.js&lt;/a&gt; library. Please refer to that website for the details on how to create the format string.&lt;/p&gt;

&lt;p&gt;These are the same helpers available in my Alfred Workflow &lt;a href="https://dev.to/#/projects/alfredp/alfredquiver"&gt;Quiver&lt;/a&gt; and &lt;a href="https://dev.to/#/projects/alfredp/alfredtemplate"&gt;Template&lt;/a&gt;.  Those workflows are using the same base code I'm using with the Svelte GitHub Website Template project. Yes, I reuse stuff that I like! Please refer to the &lt;a href="https://handlebarsjs.com/"&gt;Handlebars&lt;/a&gt; documentation for any built in helpers.&lt;/p&gt;

&lt;p&gt;If you want to add your own helpers, then add them to the &lt;code&gt;src/components/Pages.svelte&lt;/code&gt; file. All helpers that are not time sensitive should be placed in the &lt;code&gt;onMount()&lt;/code&gt; function with the ones I have there. The helpers that are time sensitive should be placed in the &lt;code&gt;processData()&lt;/code&gt; function. For example, the &lt;code&gt;{{save &amp;lt;name&amp;gt; &amp;lt;text&amp;gt;}}&lt;/code&gt; helper is in the &lt;code&gt;onMount()&lt;/code&gt; function since it is saving data on the page for use further in the page and isn't a time based function.&lt;/p&gt;

&lt;h2&gt;
  
  
  Changing Site Information
&lt;/h2&gt;

&lt;p&gt;All basic site information is kept in a Svelte store. Any component can access this information. The following is the basics found in the store:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;writable&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte/store&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;info&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;writable&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;siteName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Svelte Website Template&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;byLine&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;For creating a great website from GitHub Pages.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:5000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;GitHub&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://raw.githubusercontent.com/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;test.html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;local&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#D1BD79&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;backgroundPicture&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;borderColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#AA7942&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;divColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#ECDAAC&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;divBackgroundPicture&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;borderSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;5px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;borderRadius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;10px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;textColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;black&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;20px Times New Romand, Arial&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headerFont&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;20px Verdana, Arial&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;navFontSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;24px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;navHoverColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;showSideBar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;sideBarLeft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;widthLogo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;920&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;widthNavbar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;700&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;widthSidebar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;900&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first thing you will need to change is the &lt;code&gt;siteName&lt;/code&gt; and &lt;code&gt;byLine&lt;/code&gt; fields. These will have the name for your website and it's by-line. If you don't want a by-line, just leave it blank.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;address&lt;/code&gt; is the HTTP address for your local server. You will only need to change this if you change the port for your local server.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;GitHub&lt;/code&gt; address is the full path to your &lt;code&gt;site&lt;/code&gt; folder when you upload to your GitHub pages repository. Once it is uploaded, go to the repository in GitHub, click on the &lt;code&gt;site&lt;/code&gt; directory, then click on the &lt;code&gt;404.md&lt;/code&gt; file, and select the &lt;code&gt;raw&lt;/code&gt; button on the right.  You should now have the raw address to the &lt;code&gt;404.md&lt;/code&gt; file and see the contents in the browser. Copying the address should give you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;https://raw.githubusercontent.com/raguay/raguay.github.io/master/site/404.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put everything up to the &lt;code&gt;site&lt;/code&gt; in the variable &lt;code&gt;GitHub&lt;/code&gt;. It should look similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    GitHub: &lt;span class="s1"&gt;'https://raw.githubusercontent.com/raguay/raguay.github.io/master/site'&lt;/span&gt;,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, it will have the name of your account instead of my &lt;code&gt;raguay&lt;/code&gt; account. This will be where the &lt;code&gt;Page.svelte&lt;/code&gt; component will look for markdown pages for your site.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;parts&lt;/code&gt; variable is an array of names of files in the &lt;code&gt;site/parts&lt;/code&gt; directory. Each file named here will be loaded into Handlebars as a partial. You can then include it on any markdown page using &lt;code&gt;{{&amp;gt; 'test.html'}}&lt;/code&gt; macro. Each partial that is used causes some delay on loading the first markdown page. You might want to keep the ones you load to a minimum.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;local&lt;/code&gt; variable controls which address to use to get the pages: &lt;code&gt;address&lt;/code&gt; or &lt;code&gt;GitHub&lt;/code&gt;. If set to true, the the &lt;code&gt;address&lt;/code&gt; address is used. Otherwise, the &lt;code&gt;GitHub&lt;/code&gt; address is used. Make sure this is set to &lt;code&gt;false&lt;/code&gt; and compiled before uploading to your GitHub site!&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;styles&lt;/code&gt; object contains all the styling information for the site. Most of them are very self explanatory as they are named similar to the CSS properties. If the &lt;code&gt;showSideBar&lt;/code&gt; variable is set to true, the side bar will be visible on the left side if &lt;code&gt;sideBarLeft&lt;/code&gt; is true. It'll be on the right if &lt;code&gt;sideBarLeft&lt;/code&gt; is false. If &lt;code&gt;showSideBar&lt;/code&gt; is false, then no side bars will be shown and the content area will take the full with under the header.&lt;/p&gt;

&lt;p&gt;There are three variables in the &lt;code&gt;styles&lt;/code&gt; object that control responsive design feature.  They are &lt;code&gt;widthLogo&lt;/code&gt;, &lt;code&gt;widthNavbar&lt;/code&gt;, and &lt;code&gt;widthSidebar&lt;/code&gt;. The &lt;code&gt;widthLogo&lt;/code&gt; variable is the pixel size that the logo will stop being displayed. The &lt;code&gt;widthNavbar&lt;/code&gt; variable is the width that the navigation menu will go from horizontal to vertical. The &lt;code&gt;widthSidebar&lt;/code&gt; variable is the width that the sidebar will no longer be displayed at. You can set these to values that makes sense for your site. A very short menu will not need as large of a value as a short menu will.&lt;/p&gt;

&lt;p&gt;These variables can be set programmatically as well. That way, you can setup pages with the side bar or without. You could also set all the styling information from a menu entry to have different styles for each user. I'll most likely be adding more features for this in future versions of the template.&lt;/p&gt;

&lt;p&gt;Each component that need information from the &lt;code&gt;info&lt;/code&gt; store will have the following in it's script block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;onMount&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;info&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../store/infoStore.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;

  &lt;span class="nx"&gt;onMount&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="c1"&gt;// Subscribe to the information store to get the site information.&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;unsubscribeInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;unsubscribeInfo&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;onMount&lt;/code&gt; function is imported from &lt;code&gt;svelte&lt;/code&gt; and used to register a function that will run whenever the component is mounted to the DOM. The &lt;code&gt;info&lt;/code&gt; store is loaded from the file that defines it. In the function ran by the &lt;code&gt;onMount&lt;/code&gt; life cycle function will then register a function to run each time the library &lt;code&gt;info&lt;/code&gt; is updated. That function set a component variable (I call it a shadow variable since it shadows the original store) to the new value of the store. When updated, it will trigger a refresh on the component. Now, you can use the information in the library in the template and in other functions. Just be careful that a function doesn't get called before the store's shadow variable isn't initialized.&lt;/p&gt;

&lt;p&gt;When you subscribe to a store, the return value is the function to use to unsubscribe from the store. When you return from a &lt;code&gt;onMount()&lt;/code&gt; function call, you return a function that calls the unsubscribe function to help free up memory and processing time for updates to the store. That function is called whenever the component is unmounted (or removed from the DOM).&lt;/p&gt;

&lt;p&gt;If you need to make sure you have the latest information from a store before going forward with a function, you have to use the &lt;code&gt;get&lt;/code&gt; function to get it from the store. The store variable that you load in isn't the actual store, but accessor function to it. You get the &lt;code&gt;get&lt;/code&gt; function this way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte/store&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You then use that function to get the most current value of the store. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;localvalue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you can use &lt;code&gt;localvalue&lt;/code&gt; just like you did &lt;code&gt;info&lt;/code&gt; in the template. This is a read only variable. You can't set values in the store by using the locally saved variable. To change a store's value, you use the &lt;code&gt;set()&lt;/code&gt; method of the store. This only works if the new value is different (ie: 1 instead of 0). But for structures, this might not always be the case. Be careful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Changing the Menus
&lt;/h2&gt;

&lt;p&gt;The main menu on the website is in the &lt;code&gt;NavBar.svelte&lt;/code&gt; component. It looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;'navbar'&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"background-color: {styles.divColor};
                        background-image: {styles.divbackgroundPicture};
                        border: {styles.borderSize} solid {styles.borderColor};
                        border-radius: {styles.borderRadius};
                        color: {styles.textColor};"&lt;/span&gt; &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;'navItem'&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;'/'&lt;/span&gt; &lt;span class="na"&gt;use:link&lt;/span&gt; &lt;span class="na"&gt;use:active&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;'navItem'&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;'/blog/index'&lt;/span&gt; &lt;span class="na"&gt;use:link&lt;/span&gt; &lt;span class="na"&gt;use:active&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Blog&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;'navItem'&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;'/about'&lt;/span&gt; &lt;span class="na"&gt;use:link&lt;/span&gt; &lt;span class="na"&gt;use:active&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;.navItem&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;text-decoration-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;#navbar&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;85%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;#navbar&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nc"&gt;.navItem&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;margin-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;26px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;link&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte-spa-router&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;active&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte-spa-router/active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;onMount&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;info&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../store/infoStore.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;

  &lt;span class="nx"&gt;onMount&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="c1"&gt;// Subscribe to the information store to get the site information.&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;unsubscribeInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;unsubscribeInfo&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The items of interest in the &lt;code&gt;script&lt;/code&gt; block is the importing of the &lt;code&gt;link&lt;/code&gt; and &lt;code&gt;active&lt;/code&gt; commands. These are used in the template to define the anchor tags. The &lt;code&gt;use:link&lt;/code&gt; action in the anchors will fix the references to the local SPA router style. A normal anchor reference would be &lt;code&gt;/blog/index&lt;/code&gt;, the &lt;code&gt;link&lt;/code&gt; action changes it to &lt;code&gt;/#/blog/index&lt;/code&gt;. You don't have to use the link action, but it does make it a little easier to read.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;active&lt;/code&gt; action will show the link that is currently being displayed with the &lt;code&gt;active&lt;/code&gt; class. You have to define your &lt;code&gt;active&lt;/code&gt; class globally so that the name doesn't get specialize for the component. It is currently defined in the &lt;code&gt;WebSite.svelte&lt;/code&gt; component in order to be only defined once. It looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nd"&gt;:global&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="nc"&gt;.active&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#155393&lt;/span&gt; &lt;span class="cp"&gt;!important&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;text-decoration-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#155393&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;:global()&lt;/code&gt; command tells Svelte that this is a globally defined CSS value and it should not be name mangled.&lt;/p&gt;

&lt;p&gt;So, if you want to add a page call &lt;code&gt;Favorites&lt;/code&gt; with the markdown file name of &lt;code&gt;favorites.md&lt;/code&gt;, you would add the following to the list of anchor tags in the template:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;'navItem'&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;'/favorites'&lt;/span&gt; &lt;span class="na"&gt;use:link&lt;/span&gt; &lt;span class="na"&gt;use:active&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Favorites&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And make sure the file is in the &lt;code&gt;site&lt;/code&gt; directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Changing the Main, Sidebar, and Footer Components
&lt;/h2&gt;

&lt;p&gt;The main page (or more often referred to as the index page) is in the file &lt;code&gt;Index.svexy&lt;/code&gt; file. It has the same layout as the &lt;code&gt;About.svexy&lt;/code&gt; that we have already examined. Just add the markdown text you want in the main page. You can also include other components if needed.&lt;/p&gt;

&lt;p&gt;The Sidebar is in the &lt;code&gt;src/component/Sidebar.svelte&lt;/code&gt; component and the Footer is in the &lt;code&gt;src/component/Footer.svelte&lt;/code&gt; component.  They are nornal Svelte components that can be edited and changed as you need. Components like these that need to be edited are the reason I've made this a template and not a library. There is a &lt;code&gt;src/components/Twitter.svelte&lt;/code&gt; and &lt;code&gt;src/components/BlogPosts.svelte&lt;/code&gt; components that can be placed in the Sidebar as you want. I'll be creating more such components down the road.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding General and Blog Pages
&lt;/h2&gt;

&lt;p&gt;The format of the &lt;code&gt;site&lt;/code&gt; directory is as follow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;public/site
├── 404.md
├── blog
│   ├── index.md
│   └── my-first-post.md
└── parts
    └── test.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything under the &lt;code&gt;site&lt;/code&gt; directory is available to be sent as a page. The items in the &lt;code&gt;parts&lt;/code&gt; directory can be seen as a page if they are markdown (ie: if the name of the file ends in &lt;code&gt;.md&lt;/code&gt;). But, most partials will be HTML since they are not processed through the markdown and Handlebars processors. But, I think I will be doing that in the future.&lt;/p&gt;

&lt;p&gt;Every page needs to be a markdown file with the ending &lt;code&gt;.md&lt;/code&gt;. The files in a sub-directory are accessed as the path is normally seen. For example, the index for the blog page is &lt;code&gt;/blog/index&lt;/code&gt;. For this reason, all directories should be a single word without and spaces or anything that isn't a letter or a number (ie: all punctuation and special symbols).&lt;/p&gt;

&lt;p&gt;There isn't currently a process for building the index page for a blog. You will have to do that yourself. I'm working at adding a function to the Mask task runner for building the index pages from the post pages.&lt;/p&gt;

&lt;p&gt;Every markdown page has to start with YAML head matter at the top. The minimum information is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
  title: The title of the blog
  date: 2019-11-26
---
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The format is basically a name, &lt;code&gt;:&lt;/code&gt;, and a value. The name has to be a single word. The date is given in the &lt;code&gt;YYYY-MM-DD&lt;/code&gt; format.  Each post can display it in any format given in the heading section as seen here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## {{title}}
#### {{cdate date 'MMMM D, YYYY'}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The date is taken from the YAML head matter and formatted using the &lt;code&gt;cdate&lt;/code&gt; helper function. The format is the &lt;a href="https://momentjs.com/"&gt;Moment.js&lt;/a&gt; formatting. You can change these to anything you want. This is just the formatting that I'm using on my site.&lt;/p&gt;

&lt;p&gt;Each variable in the YAML head matter is also accessible using the Handlebar helpers just as the &lt;code&gt;title&lt;/code&gt; was used in the above example.&lt;/p&gt;

&lt;p&gt;The rest of the file is whatever markdown and text you want in your post or page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build and Deploying the Site
&lt;/h2&gt;

&lt;p&gt;I'm assuming that you already have a &lt;a href="https://guides.github.com/features/pages/"&gt;GitHub Pages repository setup&lt;/a&gt;. If not, go ahead and do that. Once setup, clone the repository to the directory &lt;code&gt;launch&lt;/code&gt;. That is best done by doing the &lt;code&gt;git clone&lt;/code&gt; command in the templates directory, copy the files/directories in the &lt;code&gt;launch&lt;/code&gt; directory to that cloned directory, delete the current &lt;code&gt;launch&lt;/code&gt; directory, and rename the cloned git directory to &lt;code&gt;launch&lt;/code&gt;. The build script will place all your site's information into the launch directory and upload it to GitHub.&lt;/p&gt;

&lt;p&gt;Once the &lt;code&gt;launch&lt;/code&gt; directory is setup, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mask build &lt;span class="s1"&gt;'initial launching'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will fully build the site, commit the changes to the git repository with the message given in single quotes, and push the changes to the GitHub repository for your GitHub pages site. Once GitHub Pages syncs, your new site will be live for everyone to see.&lt;/p&gt;

&lt;p&gt;If you don't want to use Mask, then create a script with the following lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/sh&lt;/span&gt;
npm run build
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-Rf&lt;/span&gt; launch/js launch/css launch/imgs launch/site
&lt;span class="nb"&gt;mkdir &lt;/span&gt;launch/css launch/js
&lt;span class="nb"&gt;cp &lt;/span&gt;public/&lt;span class="k"&gt;*&lt;/span&gt;.js launch/js
&lt;span class="nb"&gt;cp &lt;/span&gt;public/&lt;span class="k"&gt;*&lt;/span&gt;.css launch/css
&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="nt"&gt;-Rf&lt;/span&gt; public/imgs launch/
&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="nt"&gt;-Rf&lt;/span&gt; public/site launch
&lt;span class="nb"&gt;cp &lt;/span&gt;public/CNAME launch
&lt;span class="nb"&gt;cd &lt;/span&gt;launch
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then make the script executable using &lt;code&gt;chmod a+x&lt;/code&gt; on the file. You should then be able to use that script instead of the Mask script.&lt;/p&gt;

&lt;p&gt;The file &lt;code&gt;CNAME&lt;/code&gt; is the name of your site if your using your own domain name server for the site. GitHub Pages will then use the name in that file as the name of the web-server for your site.&lt;/p&gt;

&lt;p&gt;You only have to compile the full site each time you change a Svelte component. If you are simply adding markdown files to the public directory area, then you can just copy them to the launch area and commit them to GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Now that you know how to use this website template, go and make your own websites using it.  Please let me know what sites you create with it so I can add it to the list on the template's GitHub page. That way, everyone can see who is using this template.&lt;/p&gt;

</description>
      <category>template</category>
      <category>svelte</category>
      <category>github</category>
      <category>website</category>
    </item>
  </channel>
</rss>
