New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for running on node #48

Open
peterjwest opened this Issue Sep 27, 2017 · 7 comments

Comments

Projects
None yet
3 participants
@peterjwest
Contributor

peterjwest commented Sep 27, 2017

Can you add documentation for running on node?

I am currently using a hack found in a closed issue:

import 'undom/register';

global['document'].createDocumentFragment = () => global['document'].createElement('#fragment');

Hopefully there's a way to do this without messing with global objects!

@gnarf

This comment has been minimized.

Show comment
Hide comment
@gnarf

gnarf Oct 12, 2017

Collaborator

@peterjwest the recently released 1.1.0 version should allow you to do:

import undom from 'undom';
import {config as renderSpyConfig} from 'preact-render-spy';
renderSpyConfig.createFragment = () => undom().body;

This is documented here:

https://github.com/mzgoddard/preact-render-spy#configuration

I would be open to a PR making a change to the README with an example

Collaborator

gnarf commented Oct 12, 2017

@peterjwest the recently released 1.1.0 version should allow you to do:

import undom from 'undom';
import {config as renderSpyConfig} from 'preact-render-spy';
renderSpyConfig.createFragment = () => undom().body;

This is documented here:

https://github.com/mzgoddard/preact-render-spy#configuration

I would be open to a PR making a change to the README with an example

@developit

This comment has been minimized.

Show comment
Hide comment
@developit

developit Oct 12, 2017

import undom from 'undom';
import {config as renderSpyConfig} from 'preact-render-spy';
let doc = undom();
renderSpyConfig.createFragment = () => doc.createElement('body');

developit commented Oct 12, 2017

import undom from 'undom';
import {config as renderSpyConfig} from 'preact-render-spy';
let doc = undom();
renderSpyConfig.createFragment = () => doc.createElement('body');
@gnarf

This comment has been minimized.

Show comment
Hide comment
@gnarf

gnarf Oct 12, 2017

Collaborator

@developit would createElement('#fragment') be better/worse?

Collaborator

gnarf commented Oct 12, 2017

@developit would createElement('#fragment') be better/worse?

@peterjwest

This comment has been minimized.

Show comment
Hide comment
@peterjwest

peterjwest Oct 12, 2017

Contributor

Ace, thanks! I will be trying this out in the next few days.

Contributor

peterjwest commented Oct 12, 2017

Ace, thanks! I will be trying this out in the next few days.

@gnarf

This comment has been minimized.

Show comment
Hide comment
@gnarf

gnarf Oct 18, 2017

Collaborator

@peterjwest got any feedback, how do you think we should document this?

Collaborator

gnarf commented Oct 18, 2017

@peterjwest got any feedback, how do you think we should document this?

@peterjwest

This comment has been minimized.

Show comment
Hide comment
@peterjwest

peterjwest Oct 18, 2017

Contributor

Not yet, sorry! I will try to have a look tonight.

Contributor

peterjwest commented Oct 18, 2017

Not yet, sorry! I will try to have a look tonight.

@peterjwest

This comment has been minimized.

Show comment
Hide comment
@peterjwest

peterjwest Nov 26, 2017

Contributor

Okay, so this seems to be the most sensible/minimal setup:

import 'undom/register';
import { config } from 'preact-render-spy';
config.createFragment = () => document.createElement('body');

Although I'm not sure where the #fragment came from, maybe that's more appropriate?

Contributor

peterjwest commented Nov 26, 2017

Okay, so this seems to be the most sensible/minimal setup:

import 'undom/register';
import { config } from 'preact-render-spy';
config.createFragment = () => document.createElement('body');

Although I'm not sure where the #fragment came from, maybe that's more appropriate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment