Skip to content

svelte-style html files #46

@brumm

Description

@brumm

Hey,

I'm trying to extract dependencies from a svelte-style .html file.
It seems like precinct is trying to parse it like JSX:

❯ env DEBUG=precinct npx precinct svelte/HelloWorld.html
  precinct options given:  { es6: {} } +0ms
  precinct could not parse content: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? (7:0) +8ms
[]

This is the file content:

<div class="container">
	<h1>Hello {name}!</h1>

	<EditingMessage></EditingMessage>
</div>

<style>
	.container {
		text-align: center;
		margin-top: 2rem;

		font-family: sans-serif;
	}
</style>

<script>
	import EditingMessage from './EditingMessage.html';

	export default {
		components: { EditingMessage }
	}
</script>

I think vue single file components look quite similarly.

I may have some time later this week to look into this myself, just wanted to document this somewhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions