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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eleventy-plugin-currency-shortcode

v1.0.0

Published

An Eleventy plugin that adds a currency shortcode for displaying currency conversions with tooltips

Readme

eleventy-plugin-currency-shortcode

An Eleventy plugin that adds a {% currency %} shortcode for displaying currency conversions with tooltips - perfect for travel blogs and international content.

Installation

npm install eleventy-plugin-currency-shortcode

Usage

Add the plugin to your .eleventy.js configuration file:

import currencyPlugin from 'eleventy-plugin-currency-shortcode';

export default function(eleventyConfig) {
    eleventyConfig.addPlugin(currencyPlugin);
    
    // Your other configuration...
}

Then use the shortcode in your templates:

{% currency "15", "CAD", "11", "USD" %}
{% currency "100", "€", "85", "£" %}
{% currency "50", "USD", "67", "CAD" %}

More Examples

<!-- Travel blog example -->
The hotel cost {% currency "120", "€", "130", "USD" %} per night, which was reasonable for Paris.

<!-- Restaurant pricing -->
Dinner was {% currency "45", "GBP", "55", "USD" %} including wine.

<!-- Shopping -->
I found this jacket for {% currency "80", "CAD", "60", "USD" %} - what a deal!

Output

The shortcode generates HTML like this:

<span class="currency-convert" title="15 CAD ≈ USD11">15 CAD (~USD11)</span>

Configuration

You can customize the plugin behavior by passing options:

eleventyConfig.addPlugin(currencyPlugin, {
    shortcodeName: 'currency',          // Change the shortcode name (default: 'currency')
    className: 'currency-convert'       // Change the CSS class (default: 'currency-convert')
});

Options

  • shortcodeName (string, default: 'currency'): The name of the shortcode
  • className (string, default: 'currency-convert'): CSS class for styling

CSS Styling

The plugin generates HTML with a CSS class that you can style:

.currency-convert {
    /* Basic styling */
    color: #2c5aa0;
    font-weight: 500;
    cursor: help;
}

.currency-convert:hover {
    text-decoration: underline;
}

Example Styling for Travel Blogs

.currency-convert {
    display: inline-block;
    background: linear-gradient(45deg, #f0f8ff, #e6f3ff);
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 2px 6px;
    color: #0066cc;
    font-weight: 500;
    cursor: help;
    transition: all 0.2s ease;
}

.currency-convert:hover {
    background: linear-gradient(45deg, #e6f3ff, #d1e9ff);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,102,204,0.2);
}

Parameters

The currency shortcode accepts four parameters:

  1. fromValue (string): The original amount
  2. fromSymbol (string): The original currency symbol/code
  3. toValue (string): The converted amount
  4. toSymbol (string): The target currency symbol/code

Use Cases

Perfect for:

  • Travel blogs - Show costs in multiple currencies
  • International e-commerce - Display price comparisons
  • Financial content - Illustrate currency conversions
  • Educational material - Teach about exchange rates

Requirements

  • Node.js 18.0.0 or higher
  • Eleventy 3.0.0 or higher

License

MIT