enhance-dev / enhance-dev/arc-plugin-enhance

Differences in rendering `.mjs` files vs `.html` files

Open
#123 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Rendering a page from an `.html` files results in a different HTML output than rendering a page from an `.mjs` template file with that doesn't use the store.

## Problem
The problem is that this makes for an inconsistent author experience and complicates page level styling as there is an extra layer that is sometimes there that they then may or may not have to deal with.

## Current situation
### Rendering from `.mjs`
```js
// api/test.mjs
export function get () {
return {
'json': {},
};
}
```

```js
// pages/test.mjs
export default function test () {
return html`

This is a title


`;
}
```

Results in:
```html


This is a title


```

### Rendering from `.html`
```js

This is a title


```

Results in:
```html

This is a title

```

### Desired situation
At the very least, both situations should result in the same output so authors have a predictable output where they can apply styling to.
The most desired situation is that `.mjs` files are rendered like the `.html` files without the wrapper element so the framework is as little in the way as possible and authors can decide if they want a wrapper element, and if so what its signature is.
If a wrapper element is needed, changing the signature from `` to something like `` is preferable. That way there is a predictable element name that can be targeted with CSS and is easier queryable for folks that want JS access for some reason.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.