slak_express

1.0.3 • Public • Published

slak_express documentation

• install :

npm i slak_express

• about :
slak express is a html render engine for express, helping you to use less code for more output.

• usage

once you have installed slak_express and express you can use the following to enable it :

const express = require("express");
const app = express();
slakExpress = require("slak_express");
slakExpress(app);
app.get("/",(req,res)=>{
  res.render("index",{extraData:"test"})
})
app.listen(8080);
console.log("-->  server started!")

this will automaticly enable the slak render engine and set it as your defualt, you can then start making slak files in your views directory. for this example, we will make a index.slak file inside views folder with the following :

<!DOCTYPE html>
<?@_
//normal node works here, can console.log...
//new functions are include and echo
echo("hello world") // prints to html
_@?>
<br>normal html works too, works almost like php
<?@_
// to use data that has been rendered with page :
echo(included.extraData)
_@?>

using include

<!DOCTYPE html>
<?@_
include("item in views")
_@?>
//include will place an entire slak file where included

//if include fails it wont crash your app, it will instead print the error on your html page

Readme

Keywords

none

Package Sidebar

Install

npm i slak_express

Weekly Downloads

2

Version

1.0.3

License

ISC

Unpacked Size

3.7 kB

Total Files

3

Last publish

Collaborators

  • damian288