Getting SmarkForm

📖 Table of Contents

To incorporate SmarkForm to your project you have several alternatives:

Using a CDN (Esiest approach)

This is the quicker method for playground and testing apps.

ES module

👉 Import it as ES module:

<script type="module">
  import SmarkForm from 'https://cdn.jsdelivr.net/npm/smarkform/dist/SmarkForm.esm.js';
  
  // Use SmarkForm in your code
</script>

UMD Module

👉 Include it your HTML file using a <script> tag:

<script src="https://cdn.jsdelivr.net/npm/smarkform/dist/SmarkForm.umd.js"></script>
<script>
    // Now it is avalable as SmarkForm global variable.
</script>

👉 Import as CommonJS module:

const SmarkForm = require("https://cdn.jsdelivr.net/npm/smarkform/dist/SmarkForm.umd.js");

👉 Import as AMD (RequireJS) module:

require(['https://cdn.jsdelivr.net/npm/smarkform/dist/SmarkForm.umd.js'], function(SmarkForm) {
  // Now it is avalable as SmarkForm local variable.
});

📌 These examples will use the latest published version of SmarkForm from NPM (better for development / testing / training).

For production code is advised to rely on specific version CDN to keep it working despite any future changes.

See CDN Resources section for more details…

Download minified

Go to Download section to obtain a minified versionof Smarkform you can then serve toghether with your app.

Installing it from NPM

👉 Execute:

npm install smarkform

👉 Then you can use it with your favourite bundler or pick it in your preferred format:

node_modules
└── smarkform
    └── dist
        ├── SmarkForm.esm.js
        └── SmarkForm.umd.js

SmarkForm.umd.js can be loaded through any UMD compatibley module loader such as RequireJS among others or just with regular <script> tag, in which case it will export SmarkForm class as global variable.

Clone from GitHub

👉 Execute:

git clone git@github.com:bitifet/SmarkForm.git

👉 Then, like with NPM package, you will find it under dist directory:

dist
├── SmarkForm.esm.js
└── SmarkForm.umd.js

You can also install dev dependencies by running npm install and then

  • npm run build: To build after doing some change.
  • npm run dev: To build and watch for any source file change and auto rebuild as needed.
  • npm run test: To run automated tests.
  • npm start: To run Express server with the playground environment.