1.2.8 • Published 3 months ago

@aloskutov/eleventy-plugin-codepen v1.2.8

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

eleventy-plugin-codepen

npm npms.io (quality) npms.io (quality) GitHub DeepScan grade

DeepSource DeepSource

Just another eleventy codepen plugin.

Usage

Install via npm

npm install @aloskutov/eleventy-plugin-codepen

Load plugin in .eleventy.js

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

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

Add CodePen js-library

To add Codepen's javascript code to all pages, paste in the template:

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

To optionally add Codepen's javascript code to all pages, paste in the template:

...
{% if codepen %}{% codepen_js %}{% endif %}
    </body>
</html>

If you use optional, then on the content page, insert in the header codepen: true:

---
codepen: true
...
---

...

{% codepen "pen-url", '{"option":"value"}' %}

Custom options

OptionTypeDefault
heightinteger450Iframe height in pixels
tabstringresultActive tab. Possible values: result, html, css, js.
themestringdarkTheme, dark, light or theme id
classstringnoneCSS class (classes) to add to the iframe

Codepen custom style

For example, custom style for resizable block:

  .codepen-resizable {
    overflow: hidden;
    resize: both;
    background: white;
    padding-bottom: 10px;
  }

.codepen-resizable iframe {
    height: 100% !important;
}
{% codepen "some-pen-url-or-id", '{"style":"codepen-resizable"}' %}

Notes

Liquid & Nunjucks template:

{% codepen "some-pen-url-or-id", '{"height":500,"style":"codepen-resizable"}' %}

or option string

{% codepen "some-pen-url-or-id", "height:500,style:codepen-resizable" %}

Nunjucks template:

{% codepen "some-pen-url-or-id", {height:500, style:"codepen-resizable"} %}
1.2.8

3 months ago

1.2.7

8 months ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

0.2.0

2 years ago

1.0.0

2 years ago