npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ufx-include

v1.0.3

Published

Custom tags for importing HTML into HTML

Downloads

3

Readme

Ufx-include Tags

Two custom tags for including HTML partials

  • ufx-include - Simple import of HTML partials (fragments, parts)
  • ufx-link-include - Clickable links for loading HTML partials into targets (quick and easy SPAs)

Install

To install ufx-include: 0. Install via npm > npm i ufx-include or,

  1. Download the distribution ufx-include.min.js from here or from the release to the right.

  2. Include the JS module by including the following lin into your html (e.g. in the head section)

     <script type="module" src="/<path-to-js>/ufx-include.js"></script>

Dependencies

Ufx-include not dependent on any framework or library. It only core JS/HTML/CSS technologies and is therefore likely compatible with most frameworks.

Usage

ufx-include

The ufx-include tag is used when you just want to include a piece of html in another piece of html. Like so:

...
<body>
<ufx-include src="./header.html"></ufx-include>

Content

<ufx-include src="./footer.html"></ufx-include>
</body>
...

This is a common use case for much of the internet, include headers and footers for all pages. The ufx-include tag has a single attribute src is the url to the file containing the html to be included.

<ufx-include src="./myhtml.html"></ufx-include>

When the include is made the tag is removed and replaced with the content of the file pointed to by src.

Note that ufx-include is a custom element so you must use the closing tag. A more complete example is found here

ufx-link-include

The ufx-link-include tag is used when you want a clickable link to load HTML into some other part of your document e.g. when building a single page application. Like in this example:

...
       <header>
        <nav>
          <ul>
            <li>
                <ufx-link-include src="home.html" target-id='content'>  
                    Home 
                </ufx-link-include>
            </li>
            <li>
                <ufx-link-include src="products.html" target-id='content'>
                    Products
                </ufx-link-include>
            </li> 
...

    <div id='content'>     
    </div>
...

When the user clicks one of the links "Home" or "Products" the corresponding html file ("home.html or "products.html" is loaded into the div tag with the id 'content')

The ufx-link include tag has two attributes src and target-id. src is the url to the file containing the html to be loaded. target-id is the id of the element for which the content will be replaced with the content of the file given by src.

<ufx-link-include src="myHtml.html" target-id='elementid'>

Note that ufx-link-include is a custom element so you must use the closing tag. A more complete example is found here

Support the team

If you find that using these tags saves you time and money, and you can afford it, consider supporting us. Donate via Paypal

In the pipe

Stuff under development is:

  • Ultra-shorthand for creating HTML in JS
  • Tags for presenting and sending JSON data without using JS
  • Class library for creating desktop like applications in HTML/CSS/JS
  • Class library for easy IoT integration

Web Site

Visit the UC Software website ucsoftware.net (which is built using the ufx-include tags.)