A lightweight HTML-first programming language for building small web applications.
Gemite is a lightweight programming language inspired by PHP. It lets you create dynamic web applications by embedding Gemite code directly into HTML.
Its philosophy is simple:
- HTML first
- No framework
- No configuration
- Small and fast
- Easy deployment
- HTML-first syntax
- File-based routing
- Built-in development server
- SQLite support
- Cross-platform (Windows, Linux, macOS)
- Minimal dependencies
- Easy to learn
- Ruby-powered runtime
Install from RubyGems.
gem install gemiteCheck the installed version.
gemite versionCreate a new project.
mkdir myapp
cd myappCreate index.gmt.
<?gemite
name = "Gemite"
?>
<!DOCTYPE html>
<html>
<head>
<title>Gemite</title>
</head>
<body>
<h1>Hello, {name}!</h1>
</body>
</html>Run the development server.
gemiteOpen your browser.
http://localhost:8000
myapp/
├── index.gmt
├── about.gmt
├── users/
│ └── list.gmt
│
├── public/
│ ├── css/
│ ├── js/
│ └── images/
│
└── database.db
URL mapping
index.gmt
↓
/
about.gmt
↓
/about
users/list.gmt
↓
/users/list
// Single line comment
name = "Gemite"
count = 10
a = 10
b = 3.14
name = "Gemite"
true
false
items = [1,2,3]
user = Map()
Arithmetic
+
-
*
/
%
Comparison
==
!=
<
<=
>
>=
Logical
&&
||
!
if score >= 60
print("Pass")
end
unless logged_in
print("Login required")
end
while i < 10
i += 1
end
for i = 0; i < 10; i += 1
print(i)
end
foreach item in items
print(item)
end
break
continue
return value
func hello(name)
print(name)
end
<h1>{title}</h1>Expressions inside {} are evaluated and inserted into HTML.
String
len()
substr()
split()
join()
replace()
upper()
lower()
trim()
Math
abs()
rand()
min()
max()
Time
time()
sleep()
Files
exists()
read()
write()
append()
delete()
mkdir()
copy()
move()
JSON
json_encode()
json_decode()
SQLite
db.open()
db.query()
db.exec()
db.close()
Start the development server.
gemiteSpecify a port.
gemite s 3000Show the version.
gemite versionShow help.
gemite help<?gemite
name = "World"
?>
<h1>Hello, {name}!</h1>count = count + 1
db = db.open("database.db")
rows = db.query("SELECT * FROM users")
Clone the repository.
git clone https://github.com/<YOUR_GITHUB>/gemite.git
cd gemiteBuild the gem.
gem build gemite.gemspecThis creates:
gemite-x.y.z.gem
gem install ./gemite-x.y.z.gemVerify the installation.
gemite versionInstall dependencies.
bundle installRun Gemite from the source tree.
bundle exec gemiteor
ruby exe/gemiteGemite is released under the MIT License.
See the LICENSE file for details.