1.0.5 • Published 4 years ago

code-bed v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

code-bed

A web component for embedded CodePens.

Try it out!

Usage

Via script tag

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>code-bed usage</title>
</head>
<body>
    <code-bed
        data-slug-hash="RwWxWNB"
        data-height="150">
    </code-bed>

    <script async src="https://cdn.jsdelivr.net/npm/code-bed@1.0.5/dist/codebed.min.js"></script>
</body>
</html>

Via module bundler

  1. Install package via package manager of your choice.
npm install code-bed
  1. import 'code-bed' as part of your app module, it should then be included as part of your bundle.
import 'code-bed';

// Rest of your code...
  1. You can now use <code-bed></code-bed> in your app views!

Customization

All parameters into the code-bed web component are done so via attributes on the <code-bed></code-bed> HTML element.

The set of attributes used are the same ones used by the CodePen embed itself:

The only absolutely required attribute is:

  • data-slug-hash - The identifier for the CodePen (ex. wbVzQG)
1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago