doubleb.js is a simple and limited template system designed for projects that require more speed when generating simple static and dinamyc pages.
To use doubleb.js you only need to have Node.js > = 10.16.3
preinstalled.
There is a npm package that you can install running:
npm install doubleb.js
The only way to use doubleb.js for now is through the API.
The npm module, loaded with const doubleb = require("doubleb.js");
exposes the following functions and variables.
Reads the configuration file, renders the input files and saves them in the output directory.
Reads the configuration file in the specified path and returns the JSON Object of the configuration.
Renders config.data
, with the template config.template
, if present.
Middleware wrapper for render(config)
.
Only for custom regular expression handlers
Adds a handler for the regular expression regex
with name name
.
Only for custom regular expression handlers
Is the current configuration readed by doubleb.read_config([config_path="./_config.json"])
.
The configuration file looks like the this:
{
"$input_dir": "/some/path",
"$ouput_dir": "/some/other/path",
"$exclude": "(.*).png$",
"variable_name": "value",
"extension_variable": ["value", "value0", "abcdwxyz"]
}
Where $input_dir
is the input directory with the files to be rendered and $output_dir
is the output directory of the rendered files. variable_name
and extension_variable
are just examples. All the fields are optional.
For examples, look at the test folder.
All the code of this project is licensed under the Apache License version 2.0 (Apache-2.0).
Copyright 2019 Álvaro Torralba <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
All the documentation of this project is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.