Socket
Socket
Sign inDemoInstall

arca9

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arca9

A simple and util dependency-based html template engine that uses json and foucs on reusability


Version published
Weekly downloads
1
decreased by-95.45%
Maintainers
1
Weekly downloads
 
Created
Source

Arca9 arca9-icon

Install

npm install arca9

A simple and easy to use HTML template engine based on JSON components

    Arca9 is a simple nodejs template engine that uses xml custom tags (with arca9 prefix) and JSON components to provide a well-structured dependency-based template build. Arca9 works with a dependency system that makes way easier to build your files without the need of checking for additional components that others require, connecting all dependencies recursively and including all that is necessary.

Using versions below 1.0.5 is discouraged since you can have a lot of issues with lower versions

Please note that arca9 doesn't output formatted XML, please use a tool to format your XML file

To get a full understanding about arca9, please read the tutorial


Examples

A simple example without using files (components, scripts, etc.):

const arca9 = require('arca9');

 //enable logs about project build (false is default)
arca9.options.echo = true;

//A html string
var str =
`<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <arca9-foreach name="clients"> 
    	Name:  %{k} - Age: %{v:age} - Money: %{v:money} <br />
    </arc9-foreach>
</body>
</html>`;

//Builds the xml/html string
var result = arca9.buildStr(str, {
	clients: {
		john: {
			age: 32,
			money: 3000
		},
		
		mary: {
			age: 19,
			money: 563
		},
		
		dean: {
			age: 32,
			money: 45
		}
	}
});

console.log(result);

/*
<!DOCTYPE html>
<html>
<head>
</head>
<body>
        Name:  john - Age: 32 - Money: 3000 <br />
        
        Name:  mary - Age: 19 - Money: 563 <br />
        
        Name:  dean - Age: 32 - Money: 45 <br />
</body>
</html>
*/

A simple example with components and external file

main.js
const arca9 = require('arca9');

arca9.options.echo = true;

arca9.build("input.html", "output.html", { author: "woodenbell" });
input.html
<!DOCTYPE html>
<html>
    <head>
        <title>
            My page - by <arca9-var name="author" />
        </title>
    </head>
    <body>
        <arca9-component src="simple_button.json" 
            values-content="My button" values-color="#000000" />
    </body>
</html>

simple_button.json

{
    "import": [],
    "content": [{
        "tag-name": "span",
        "self-closing": false,
        
        "content": [
        "%{content}"
        ]
    }],
    
    "attr": {
        "name": "mybtn"
    },
        
    "style": {
        "background-color": "%{color}"
    }
}

Result (output.html)

<!DOCTYPE html>
<html>
    <head>
        <title>
            My page - by woodenbell
        </title>
    </head>
    <body>
	    <button name="mybtn" style="background-color: #000000; "><span>My button
	    </span></button>
    </body>
</html>

    

Keywords

FAQs

Package last updated on 21 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc