@html_first/html_scrambler v2.1.2
html_scrambler
a simple yet highly extendable nodeJS SSG scrambler library.
for scrambling generated static web html resources from, including but not limited to:
- bootstrap studio.
- pinegrow.
- WYSIWYG web builder.
- or bassically any program that generate static web folder, as long as it is able to add custom html attribute.
into chunks of file, that(by extending our builder_class) are usable for any html based web framework/templating language like:
- laravel blade,
- svelte,
- next,
- ejs, or...
- basically anything.
or at least that is the mission of this project
how to initiate
create file in your project folder
// main.mjs
// @ts-check
import { h_watcher } from '@html_first/html_scrambler';
const watcher = new h_watcher({
/**
* options
* make no worries as we already make it type safe and ?documented? inside the module
*/
});
watcher.run({
/**
* options
* ditto
*/
});
initiate watcher using
node main.mjs
html call pattern
to call your class;method add attribute on the element to proccess
- build and
- bdashindex="class_nameattribute_delimitermethod_nameattribute_delimiter...arguments"
which then be called each index incrementally (starts from 1) and will end if there are no more index+1 after the curent index
nb
- you might want to utilize attribute_delimiter_2 and attribute_delimiter_3 from (inside builder class) this.builder.b_build.attribute_delimiter_2 or this.builder.b_build.attribute_delimiter_3 for this.builder.split to split with escaped curent delimiter
html example
<div id="test" build b-1="php;foreach;$table as $row">test</div>
meaning:
- that #test element will call registered class named php,
- run method named foreach
- with "$table as \$row" as first argument
which, with our example class, php, it will result into
<?php foreach($table as $row){ ?><div id="test">test</div><?php };?>
* examples are available in the listed github repo
code splitting
our example class also have bss class, which show code example on how to code split one html into multiple file
you can call it using partial method
<div id="test" build b-1="bss;partial;component/test.blade.php;@include('view.name')">test</div>
which will turn main html line into
@include('view.name')
and create new file at "${build_path}/component/test.blade.php" with this
<div id="test">test</div>
How to install
npm i @html_first/html_scrambler
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago