3.0.1 • Published 6 months ago

@codebundlesbyvik/html-dev-label v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

html-dev-label

npm npm - downloads per week

An HTML element rendered on page indicating that your project is compiled with process.env.NODE_ENV set to development.

html-dev-label

Why?

It's easy to confuse the development environment of a website with production when you have many tabs & windows open. Well, not any more.

Installation and usage

Install the package with npm.

npm install @codebundlesbyvik/html-dev-label

Import and initialize htmlDevLabel. I recommend you do this in your main JavaScript file.

import htmlDevLabel from "@codebundlesbyvik/html-dev-label";

htmlDevLabel(["top", "left"]);

Options

htmlDevLabel accepts a single, optional parameter which is either:

  • An Array with 2 position values, or
  • An Object containing one or more of the option entries listed in the table below.
KeyTypeDefaultDescription
parentElHTMLElementdocument.bodyElement of which the label will become the first child.
position["top" \| "bottom", "left" \| "right"]["bottom", "right"]Position of the label.
size"sm" \| "md" \| "lg""md"Size of the label.
textString"Build: dev"Text shown inside the label.
fontFamily"monospace" \| "sans-serif" \| "inherit""monospace"Style of font family used for the label text. Will use the computed value of the parent element when set to "inherit".
backgroundColorString"#FFFFFF" (white)Background color of the label.
borderColorString"#FF0000" (red)Border color of the label.

Migrating from version 2

  • If you manually set position then you must convert its value to an Array.
  • The default font-family used for the label text has changed.
    • If you prefer the old look, use value "sans-serif" for the fontFamily option.

License

MIT © 2023 Viktor Chin-Kon-Sung