Common web assets for use in LizardByte projects.
Published package assets are available through jsDelivr. For example, a language icon can be embedded directly:
<img
src="https://cdn.jsdelivr.net/npm/@lizardbyte/shared-web@latest/dist/language-icons/JavaScript.svg"
alt="JavaScript"
width="32"
height="32"
/>Replace latest with a published package version for an immutable URL. URL-encode
icon filenames that contain spaces or other reserved characters.
- Add the dependency to your package.json file:
npm install @lizardbyte/shared-web --ignore-scripts
-
Add a
.npmrcfile to the root of your project with the following contents.//npm.pkg.github.com/:_authToken=TOKEN @lizardbyte:registry=https://npm.pkg.github.comReplace
TOKENwith a valid GitHub token with read access to the package registry.See Authenticating with a personal access token for more information or alternative methods of authentication.
-
Add the dependency to your package.json file:
npm install @lizardbyte/shared-web --ignore-scripts
Create an initializer such as docs/crowdin-init.js:
globalThis.initCrowdIn('LizardByte-docs', 'dockle');Then configure Dockle to load the CrowdIn assets from either jsDelivr or the installed npm package.
[targets.jsdoc]
extra_files = ["docs/crowdin-init.js"]
extra_stylesheets = ["https://cdn.jsdelivr.net/npm/@lizardbyte/shared-web@latest/dist/crowdin-dockle-css.css"]
extra_javascript = [
"https://cdn.jsdelivr.net/npm/@lizardbyte/shared-web@latest/dist/crowdin.js",
"crowdin-init.js",
]Replace latest with a published package version for immutable URLs.
Install the package, then configure Dockle to copy and load its assets:
npm install --save-dev @lizardbyte/shared-web --ignore-scripts[targets.jsdoc]
extra_files = [
"node_modules/@lizardbyte/shared-web/dist/crowdin.js",
"node_modules/@lizardbyte/shared-web/dist/crowdin-dockle-css.css",
"docs/crowdin-init.js",
]
extra_stylesheets = ["crowdin-dockle-css.css"]
extra_javascript = ["crowdin.js", "crowdin-init.js"]