
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
html-compiler
Advanced tools
Plain HTML with inlcudes support. Say what?
Indeed!
html-compiler
compiles your HTML adding includes support using special string(s) you add
to your HTML.
NOTE: The destination folder, dist
by default, is cleaned out with every build. Also, your static assets(images, css, js) are not copied accross by this utility. Because, do one thing and do it well.
For a simple file system command utility in Nodejs, take a look at fs-extra-cli
Inside your HTML document, add the following string where you want to include a file:
#html-include=folder/index.html
The path specified should be relative to the root of your project folder. When you run html-compiler
, it will replace the above string with the contents of the file you specified, and write the processed contents to a folder called dist
by default.
When including assets, these need to be linked absolutely to avoid problems with nested files and folders when serving your site. html-compiler
takes the grunt work out of this with the #html-include-asset
string. For exmaple:
<link rel="stylesheet" href="#html-include-asset=/css/libs/prism.css" media="screen" />
When using common incldues such as a navigation menu, one rus into the same problem as with assets, where relative linking will cause the navigation to not function on any nested pages. To remedy this, html-compiler
includes the #html-include-link
directive. For example:
<li><a href="#html-include-link=/style/color/">Color</a></li>
As with assets, this will cause the above string to be processed prepending the site root to the specified URL.
Have a look at the styleguide folder in this repo for example usage, and see the documentation below for more on the options available.
npm install html-compiler
From the command line call html-compiler
specifying the folder containing the HTML files.
html-compiler --rootFolder=foldername --siteRoot=http://localhost:8000/dist
Currently, when writing your files to the destination directory, the original root folder is preserved. This is not always desirable. html-compiler
now includes a preserveRoot
command line parameter to control this behaviour.
If you want to write the contents of your root folder directly to the destination directory, without preserving the root folder, run the command as before.
html-compiler --rootFolder=foldername
If however you wish to preserve the original root, call html-compiler
as follows:
html-compiler --rootFolder=foldername ---preserveRoot
Assets needs to be linked absolutely from the site root, in order to facilitate this, html-compiler
uses the string #html-include-asset
, for example:
<link rel="stylesheet" href="#html-include-asset=/css/libs/prism.css" media="screen" />
Now call the utility as follows:
html-compiler --rootFolder=styleguide --siteRoot=http://localhost:8000/dist
Allows you to specify the output directory for processed files. Defaults to dist
html-compiler --rootFolder=styleguide --dest=public --siteRoot=http://localhost:8000/dist
FAQs
Plain HTML with inlcudes support
The npm package html-compiler receives a total of 0 weekly downloads. As such, html-compiler popularity was classified as not popular.
We found that html-compiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.