Introduction to the

To learn and understand a framework in depth, the official documentation must be read carefully. The FYNE website has very systematic and detailed documentation. Official website: https://fyne.io/. Sometimes there is a need to look at documents offline. I often travel between Hangzhou and Shanghai by high-speed rail. The subway and high-speed rail usually have poor network or even no network. So I went out and researched how to build a Fyne offline document.

First, I found the GitHub repository of the official Fyne website at https://github.com/fyne-io/developer.fyne.io. I soon found out that the Fyne website was built using Jekyll. Jekyll is a static web tool written in Ruby. Jekyll is often used to create personal blogs. It supports writing articles using Markdown syntax, and then automatically generates the corresponding static pages to be hosted on a remote host for users to access. In order to run documents locally, we must first install the Ruby + Jekyll environment.

Windows

On the Windows platform, we can download it from https://rubyinstaller.org/downloads/ RubyInstaller double-click install directly. Here we download Ruby+ DevKit 2.6.6-1(x64).

This installs both the Ruby base environment and the MSYS2 development environment (used to write and compile C extensions).

By default, the directory where the executable resides is added to PATH:

The MSYS2 development environment is also installed by default:

After Ruby is installed, the MSYS2 development environment is installed using RIDK:

After the installation is complete, open CMD and type ruby-v. If the correct Ruby version information is printed, the installation is successful. If the prompt command cannot be found, the installation did not succeed or the environment variable is set incorrectly:

Mature compiled languages often have package management tools for downloading and managing dependencies. Just as Node has NPM, Python has PIP, Rust has cargo, and Ruby has its gem. Gem needs to be downloaded and installed separately. Download the address https://rubygems.org/pages/download. You can directly download the TGZ/ZIP archive, or the GEM file, or use Git to clone from the GitHub repository.

  1. After downloading the zip package, unzip it;
  2. CD to the unzipping directory;
  3. Perform the Ruby Setup. rb installation.

After the installation is complete, open CMD and type gem -v. If the correct gem version information is printed, the installation is successful. If the prompt command cannot be found, the installation fails or the environment variable is set incorrectly:

Mac

You can install Ruby and Gem directly with BREW on the Mac.

Install jekyll

Once the gem installation is complete, installing Jekyll is simple. Just execute gem install jekyll and wait for the installation to complete.

Clone official website warehouse

We use git to clone the official repository to the local computer:

$ git clone [email protected]:fyne-io/developer.fyne.io.git

Install dependencies

CD to developer.fyne. IO directory and use gem to install all dependencies of the site:

$ gem install -g

The speed of the gem installation depends on your network speed, so be patient

Locally running website

All you need to do is enter the following commands and the site will run locally:

$ jekyll serve

The following error usually occurs:

We can start the bundle using the command in the error message:

$ bundle exec jekyll serve

Run successfully:

At this point, we can type in the browser: http://localhost:4000 and you can browse the local website.

conclusion

This article describes how to build the Fyne offline document, you can follow the analogy ~

reference

  1. Fyne. Developer. IO GitHub:https://github.com/fyne-io/developer.fyne.io
  2. Go a library GitHub:https://github.com/darjun/go-daily-lib daily

I

My blog: https://darjun.github.io

Welcome to pay attention to my WeChat public number [GOUPUP], learn together, make progress together ~