Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <script type="text/js-worker">
    // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
    async function sha256(message) {
        // encode as UTF-8
        const msgBuffer = new TextEncoder('utf-8').encode(message);

        // hash the message
        const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);

        // convert ArrayBuffer to Array
        const hashArray = Array.from(new Uint8Array(hashBuffer));

        // convert bytes to hex string
        const hashHex = hashArray.map(b => ('00' + b.toString(16)).slice(-2)).join('');
        return hashHex;

    self.addEventListener('message', async function (e) {
        const hash = await sha256(e.data);
    }, false); 

    <input type="text">
    <span>Text to hash</span>
              @use postcss-nested;
@use postcss-cssnext;

body {
    background: #002F47;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    flex-flow: column nowrap;
    font-family: "Roboto", sans-serif;

label {
    position: relative;
    & span {
        position: absolute;
        top: 0;
        display: block;
        color: #A9CEB7;
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
        text-transform: uppercase;
        font-weight: 700;
        opacity: 0.5;
        transform: translatey(calc(-100% - 5px));

input {
    border: 5px solid #1C7F81;
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
    padding: 1rem;
    border-radius: 5px;
    font-size: 2rem;
    outline: none;
    &:active {
        border-color: #289B80;
        & + span {
            opacity: 1;

output {
    color: #91DCC5;
    padding: 25px;
    font-size: 3rem;
    word-wrap: break-word;
    font-family: 'Roboto Mono', monospace;
              const { createStore, compose, applyMiddleware } = Redux;
const { runSaga, eventChannel } = ReduxSaga;
const { call, take } = ReduxSaga.effects;

const reducer = ()=>({});
const sagaMiddleware = ReduxSaga.default();
const store = createStore(reducer, {}, compose(
store.runSagas = sagaMiddleware.run;

// ------------ Worker

function createWorker(){
    const scripts = Array.from(document.querySelectorAll('script[type="text\/js-worker"]'));
    const blob = new Blob(
        scripts.map( script => script.textContent),
        {type: 'text/javascript'}
    const url = window.URL.createObjectURL(blob);
    return new Worker(url);

// ------------ Sagas

function createWorkerChannel(worker) {
    return eventChannel(emit => {

        const onMessage = (event) => emit(event.data);
        worker.addEventListener('message', onMessage, false);
        const unsubscribe = () => worker.terminate();
        return unsubscribe

function* outputHash(hash){
    const node = yield call([document, 'querySelector'], 'output');
    node.textContent = hash;

function* addListeners(worker){
    const node = yield call([document, 'querySelector'], 'input');
    node.addEventListener('input', (e)=> worker.postMessage(e.target.value));

function* initialize(){
    const worker = yield call(createWorker);
    const channel = yield call(createWorkerChannel, worker)
    yield call(addListeners, worker);
        const payload = yield take(channel);
        yield call(outputHash, payload);

// ------------ Run

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.