English 中文(简体)
RIOT.JS - Environment Setup
  • 时间:2024-11-03

RIOT.JS - Environment Setup


Previous Page Next Page  

There are two ways to use RIOT js.

    Local Installation − You can download RIOT pbrary on your local machine and include it in your HTML code.

    CDN Based Version − You can include RIOT pbrary into your HTML code directly from Content Depvery Network (CDN).

Local Installation

    Go to the https://riot.js.org/download/ to download the latest version available.

    Now put downloaded riot.min.js file in a directory of your website, e.g. /riotjs.

Example

Now you can include riotjs pbrary in your HTML file as follows −

<!DOCTYPE html>
<html>
   <head>
      <script src = "/riotjs/riot.min.js"></script>
      <script src = "https://cdnjs.cloudflare.com/ajax/pbs/riot/3.13.2/riot+compiler.min.js"></script>
   </head>
   <body>
      <messageTag></messageTag>
      <script>
         var tagHtml = "<h1>Hello World!</h1>";
         riot.tag("messageTag", tagHtml);
         riot.mount("messageTag");
      </script>
   </body>
</html>

This will produce following result −