alins-compiler-web
TypeScript icon, indicating that this package has built-in type declarations

0.0.36 • Public • Published

stars forks version downloads jsdelivr visitors

author license Size TopLang issue Dependent

🚀 Alins: The most pure and elegant WebUI framework

中文 | Documentation | Playground | Update Log | Feedback Errors/Defects | Gitee | Message Board

Alins Web Compiler

Alins provides a browser environment compiler that can be used for development and debugging. Since it is compiled directly in the browser environment, it is not recommended to be used directly in the production environment.

1. Use

Save the following code in an html file to compile and run the alins application directly in the browser environment:

<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>Document</title>
</head>
<body>
     <script src='https://unpkg.com/alins-compiler-web'></script>
     <script type='text/alins'>
         let count = 1;
         <button onclick={count++} $$body>
             count is {count}
         </button>;
     </script>
</body>
</html>

2. type attribute

The web compiler can recognize three types, text/alins, text/babel, text/jsx, and compile and execute the code in them.

3. import attribute

You can use the import attribute to top the import statement. The optional values are:

  1. esm: means using the import statement to introduce alins
  2. cjs: means using the require method to introduce alins
  3. iife means importing alins from window.Alins, the default value is iife

How to use it

<script type='text/alins' import="esm">
     let count = 1;
     <button onclick={count++} $$body>
         count is {count}
     </button>;
</script>

4. ts attribute

The ts attribute is used to determine whether to use typescript

The opening method is as follows

<script type='text/alins' ts>
     let count: number = 1;
     <button onclick={count++} $$body>
         count is {count}
     </button>;
</script>

Package Sidebar

Install

npm i alins-compiler-web

Weekly Downloads

22

Version

0.0.36

License

MIT

Unpacked Size

8.01 MB

Total Files

7

Last publish

Collaborators

  • theajack