Front End Engineer, Nodejs Developer, UI/UX Designer

O

G

botemiungbamila
font-size: max(1.6em, calc(16px + (22 - 16) * ((100vw - 500px) / (790 - 500))))

^_^, For web devs

Phiz

There probably isn't much to see in a face that could be drawn in less than 20 seconds:0_0

The Case Of A Functional App

A Minimalist HTML Visual Reference Generator For SVG Files Such As The Ones InFONT AWESOME

Both individual svg files and svg sprites are supported

For fontawesome zip files, svg sprites are located in thespritesfolder.
Otherwise, activate this switchif you wish to make a sprite from multiple, individual svg files.
Processing files0 of 0

<fileName>
<lastModifiedDate>
<size>

A Surmise of Both Content Generation and Design for the App

Prototyping its UI/UX

Draft 1#

The flow of the app initially comprised a section focused on initiating user input via single or multiple file uploads
This implies "minimal" content in direct speech and summaries such as "Both individual svg files and svg sprites are supported"

Draft 2#

Upon upload, the user needs to see the details of the uploaded file. Hence the bottom snackbar for file details and uploaded files count.

The separation of the bottom bar from the primary design necessitated the design of an initially hidden section where much of the heavylifting occurs. Support for multiple svg files was also added in this draft
[COROLLARY]:

Shades of cool gray were permanently set as the colour variation for easy emphasize of a region via a vibrant colour use.


Adding Flows to the UI

Draft 3#

Upon selecting the files, the section that does the heavy lifting is revealed in a transition that covers the previous section totally, its contents are without any frivolities for the user needs minimal or no input to finish what was started.

In the case of the user activating the toggle for making sprites out of multiple uploads, the generated sprite is presented for download or dismissal after which this section reveals itself as mentioned before

Draft 4#

This section features some assumed defaults in an effort to lessen cognitive load by making more happen from less or no interaction on the part of the user. The buttons to "begin" and exit this section are positioned close to each other in order for more (begin or exit) to be done with less panning of the mouse

Status of operation and technical info ...
The content at the far-right of the design abovebeside by default, shows on desktop and hides on mobile. A sample of the results to be expected is shown in the middle of the design. The script ends by showing either a link to download the generated HTML file or a button to retry due to errors on mobile
[COROLLARY]:

The switch and behaviour to make a sprite out of multiple SVG files was added at this stage as well as a vibrant colour for the download buttons that appear through out the flow of the design.

The pseudo codes below explain the algorithm...

The core of the algorithm uses the dynamic rgx object below. The result of

FileList[i++].text().then(text=>{
  arr = text.split(rgx.tag(<input>.value||'symbol'))
})

is an array that gets looped over via

requestAnimationFrame((id, el)=>{
  (el = arr.shift())?el.replace(rgx[attr](<input>.value)||rgx['all attributes'], attr=>/**/):cancelAnimationFrame(id)
})
let rgx = {
  'all attributes': /[^,>]+/,
  attr: _=>new RegExp(`\\s${_}\\s*=\\s*("|')[^,("|')]+("|')`),
  tag:  _=>new RegExp(`<${_}`)
}

"A Thousand Words" In Images

Vanilla HTML? No Frameworks

With the explosion in the popularity and use of web development frameworks such as React, it has become an industry default to use these "frameworks" for large projects. However, novel bugs require novel solutions and slapping on a feature that is foreign to the core of the framework of choice will only lead to more added features masked as updates with, of course, backwards incompatibilities with codes written in earlier versions.
A software development approach with few ties to added layers of complexities - frameworks, offers the "free rein" that an experienced developer seeks; this website uses the TailwindCSSframework sparingly for rapid prototyping only. The problem of increase in markup due to the atomic CSS approach is solved by fetching both the markup and/or its contents using AJAX
The much used CSS class on this site - tooltip, has all its declarations written by "hand" because custom designs require custom styles. Any CSS framework hoping to augument such custom styling to its existing codebase may as well become a CSS library instead, the only catch being that they are uncommon and needless with good reason.

The following is a side by side comparison of the performance of using a template engine, Handlebars in this case and a discovered alternative in Node.js

npm -v && node -v: 9.5.1 && v16.15.1

Template Engine - Handlebars
show code

settings.hbs
Running the program via anindex.jsfile as follows
let Handlebars = require('handlebars'),
    settings  = Handlebars
    .compile(fs
    .readFileSync('./templates/settings.hbs',
  'utf-8'));
settingsTemplate({/**/});
Performance
console.time('alternate'),
  settings({/**/}),
console.timeEnd('alternate')
gave execution times between ~35x to ~50x longer such as 19.016ms, 19.559ms, 19.855ms

Discoverd Alternative
show code

settings.js
//require'd as a module or package
let settings = require('./templates/settings');
settings({/**/})
Performance
console.time('alternate'), settings({/**/}),
console.timeEnd('alternate')
gave execution times lesser than1
2
of1ms
such as 0.556ms, 0.368ms, 0.402ms

Serving HTML templates in Nodejs

While the use of templating engines in Node.js is a best practice, it is not cast in stone and faster alternatives as shown above should be sought
Building HTML on the fly in Node.js with room for customizations is possible with the code below. While it can't possibly consider all possibilities without contributions from the open source community, it is a start

npm -v && node -v: 9.5.1 && v16.15.1

wrap-in-html.js (abridged)
show code

Usage
show code

Manipulating DOMStrings in Node.js

This code base is just a working, practical concept on how serving HTML in Node.js may be improved, it may later become either a GitHub repository or npm package

JS & HTML as regards this site

${window.location.href}

This site uses an object pageData to store key nodes, Nodelists and functions as properties or as nested objects. Other needed nodes are then accessed via their parent, sibling, child relationships with these key nodes.
An example is the fixed navigation on this page accessed anywhere via pageData.article_1.nav,the code to collapse or expand it onclick or (body > main).onscroll uses pageData.article_1.nav_arrwhich gets defined when the collapse button on nav gets clicked the very first time as follows
HTMLButtonElement.onclick = function() {
  let pN=this.parentNode;
(pageData.article_1.nav_arr||=
slice(pN.children, 0, 2))
/* other scripts */
}
Given that the script that expands or collapses the nav when scrolling the page checks whether pageDate.article_1.nav_arr is defined, the expanded state of nav at the beginning of the page and during scrolling become defaults with no JavaScript
In order to make walking the DOM via relationships easy, objWalk is defined with abbreviations set through
objWalk.setDict(['classList', 'previousSibling', 'nextSibling', 'lastChild', 'firstChild', 'nextElementSibling', 'previousElementSibling', 'parentNode', 'lastElementChild', 'childNodes', 'firstElementChild'])
which defines objWalk.dictas
{ "fEC":"firstElementChild", "cN":"childNodes","pN":"parentNode", "lEC":"lastElementChild", "pES":"previousElementSibling", "nES":"nextElementSibling", "fC":"firstChild","lC":"lastChild", "nS":"nextSibling", "pS":"previousSibling","cL":"classList" }
objWalkis used as follows
objWalk(<HTMLElement>, [{2:'pN'}, {2:'nES'}, 'cL'])
to access the classList of the two nextElementSiblings of the parent of the parent of <HTMLElement>

Alternative to Task Runners in Node.js

### style.sh
#!/usr/bin/env bash
cat ./src/styles/*.scss | sass > ./public/dist.css
 
### script.sh
#!/usr/bin/env bash
cat ./src/scripts/*.js > ./public/dist.js
 
### build.sh
#!/usr/bin/env bash
./style.sh
./script.sh
It compiles .scss into css and puts the result into ./public/dist.css. It also puts all the contents of the .js files in ./src/scripts/ into ./public/dist.js.

It may be used in lieu of the more common task runners; gulp, grunt, jest, with or without Node.js

sourceblog.logrocket article on Node.js task runners vs. module bundlers