Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Simple Example fails #152

Closed
Krutsch opened this issue Jan 18, 2024 · 1 comment
Closed

Simple Example fails #152

Krutsch opened this issue Jan 18, 2024 · 1 comment

Comments

@Krutsch
Copy link

Krutsch commented Jan 18, 2024

The Example in readme:

import Critters from 'critters';

const critters = new Critters({
  // optional configuration (see below)
});

const html = `
  <style>
    .red { color: red }
    .blue { color: blue }
  </style>
  <div class="blue">I'm Blue</div>
`;

const inlined = await critters.process(html);

console.log(inlined);
// "<style>.blue{color:blue}</style><div class=\"blue\">I'm Blue</div>"

fails with this message:

file:///C:/Users/.../node_modules/critters/dist/critters.mjs:519
    document.documentElement.setAttribute('data-critters-container', '');
                             ^

TypeError: Cannot read properties of undefined (reading 'setAttribute')
    at createDocument (file:///C:/Users/.../node_modules/critters/dist/critters.mjs:519:30)
    at Critters.process (file:///C:/Users/.../node_modules/critters/dist/critters.mjs:1123:22)
    at file:///C:/Users/.../test.js:15:32
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:120:12)

Device: Windows 11, Node.js version 21.6.0

@kara
Copy link
Collaborator

kara commented Oct 25, 2024

Closing this issue because ownership of Critters has moved to the Nuxt team, who will be maintaining the project going forward. This repo is archived and won't receive any future updates.

If the issue is still relevant, please re-post it to the actively-maintained fork at https://github.com/danielroe/beasties.

@kara kara closed this as completed Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants