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

@kevingimbel/eleventy-plugin-codepen

v1.0.1

Published

Embed CodePen pens into eleventy sites

Readme

eleventy-plugin-codepen

Embed CodePen.io Pens into your eleventy website

Usage

Install via npm

npm install @kevingimbel/eleventy-plugin-codepen --save

Load the plugin in .eleventy.js

Include it in your .eleventy.js config file:

const codepenEmbed = require("@kevingimbel/eleventy-plugin-codepen");

module.exports = (eleventyConfig) => {
  eleventyConfig.addPlugin(codepenEmbed);
};

Load the CodePen javascript library

The embed requires the CodePen JavaScript library to work. For convenience the library can be loaded with a shortcode. This is best done near the closing body tag and only needs to be done once!

...
{% codepen_js %}
</body>
</html>

Use the shortcode!

The only required arguments is the CodePen full URL of the Pen or the "slug". This is the random letters in the URL, for example the Pen https://codepen.io/kevingimbel/pen/LXxoEL has the slug "LXxoEL".

It is up to you what you want to specify, although the full URL may be more future proof (e.g. if you want to replace this Plugin with a plugin that prints the URL instead of creating an embed.).

{% codepen "https://codepen.io/kevingimbel/pen/LXxoEL" %}

Config Options

All of these can be set in the .eleventy.js config as well as inline (see below).

| Option | Type | Default | Comment | | ----------- | ---- | ------------- | ------- | | height | Number | 256 | The height of the embed iframe | | theme | String | dark | Free codepen users can use light or dark, CodePen Pro users may use additional themes | | tabs | String | result | possible values: html, css, js, result. Combine with comma like html,result | | user | String | Captain Anonymous | name of the user who created the pen | | title | String | Unknown Pen | The title of the pen, used when embed can't be rendered | | preview | Boolean | true | If true, shows a "run pen" button instead of automatically running code | | editable | Boolean | false | Makes pen editable, requires CodePen Pro |

Overwriting options inline

All options can also be overwritten "inline" when the shortcode is used. Because 11ty doesn't support names parameters, and there are quite a lot of options, all options are specified in one string.

The config string is split at each semicolon (;) and each colon (:) to create key-value pairs, as shown in the following table

| Option String | Parsed object | | ------------- | ------------- | |tabs:html,result;title:single-div Link from Legend of Zelda| {tabs: "html,result", title: "single-div Link from Legend of Zelda" } |

Setting all options looks like:

"height:256;theme:dark;tabs:result;user:Captain Anonymous;title:Unknown Pen;preview: true;editable: false"

Credits

  • Huge thanks to CodePen.io for providing a great embed script. This plugin is only a wrapper around the existing functionality.