Get Started with ClearlyJS
What is ClearlyJS?
ClearlyJS is a simple and open source JavaScript library, made for making small-scale apps in no time - and without learning a new language! ClearlyJS uses the latest JavaScript features (Such as JSX), combined with the legacy HTML and Vanilla JS to make the best of both worlds. ClearlyJS contains functions for DOM elements, URLs, cookies, XML elements and more, and even has tools and add-ins to help you build stable and fast apps!
Make your first ClearlyJS app
ClearlyJS lets you write your page in multiple ways - or to do it in your way!
The ClearlyJS syntax is similar to React - so if you're moving from or to React, It'll be an easy move!
1. Import ClearlyJS
To start using ClearlyJS, open a new HTML page and add this line as the first line of your head tag:
It is recommended to use ClearlyDebug:
That's it! your project is now connected to ClearlyJS!
Another way to import ClearlyJS
You can also import ClearlyJS directly from your JavaScript files - just type:
Important: This method will only work if you import your JavaScript file as a module:
This method to import ClearlyJS will be available soon
2. Optional: Set-up Babel and JSX
JSX lets you write HTML code - and use it in React and in ClearlyJS! JSX files need to be compiled by a JavaScript compiler named Babel in order to use them.
After downloading, go to your terminal and type:
(this will download Babel and the React JSX plugin)
That's it!
Compile a .jsx file
On Windows
You can use an automated tool to start compiling faster:
Download the zip file below, extract it and drag the .bat file to your project's folder and run it. you'll be asked to specify the folder with the jsx files and the output folder. Closing the window will stop the compilation. You can edit the batch file to match your needs.
On any other OS (including Windows ;)
First, extract the zip file below and put the .babelrc file in your project.
Open your terminal and type:
(replace the JSX-FILE-OR-FOLDER and OUTPUT-FOLDER parameters with your directories)
Closing the terminal window will stop the compilation.
3. Hello World
We'll now make a simple Hello World app.
Start a new project with two files: index.html and index.js (or index.jsx).
In the index.html file - we'll import ClearlyJS then import our script as defer:
In the index.js we'll write:
Try running the HTML file.
Last updated