@substrate-system/wavy-hr
v0.0.8
Published
HR tag with style
Readme
wavy hr
An hr tag with style.
[!IMPORTANT]
Be sure to copy the file./dist/wave.svginto the root public folder on your web server. The CSS depends on that file.
install
npm i -S @substrate-system/wavy-hrAPI
ESM and common JS via package.json exports field.
ESM
import '@substrate-system/wavy-hr'Common JS
require('@substrate-system/wavy-hr')CSS
Import CSS
import '@substrate-system/wavy-hr/css'Or minified:
import '@substrate-system/wavy-hr/css/min'use
This calls the global function customElements.define. Just import, then use
the tag in your HTML.
JS
import '@substrate-system/wavy-hr'HTML
<div>
<wavy-hr></wavy-hr>
</div>pre-built JS
This package exposes minified JS files too. Copy them to a location that is accessible to your web server, then link to them in HTML.
copy
cp ./node_modules/@substrate-system/wavy-hr/dist/index.min.js ./public/wavy-hr.min.jsHTML
<script type="module" src="./wavy-hr.min.js"></script>Server-side rendering
For server-side rendering scenarios, you can use the /html export to generate the HTML string without requiring a browser environment.
import { render } from '@substrate-system/wavy-hr/html'
const html = render()
// Returns: '<hr class="wavy-hr" />'Use case example
// In your server-side rendering code
import { render } from '@substrate-system/wavy-hr/html'
function renderPage() {
return `
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/path/to/wavy-hr.css">
</head>
<body>
<h1>My Page</h1>
${render()}
<p>More content...</p>
</body>
</html>
`
}[!NOTE]
When using server-side rendering, you still need to include the CSS file and thewave.svgasset for proper styling. Therenderexport only provides the markup structure.
