Skip to content

Vite usage #81

@IgnaceMaes

Description

@IgnaceMaes

I was in need for a code snippet extraction too, but could not get this addon to work under Vite.

After some searching around, I found I was able to use TheEcosystem™️ :

import MyComponent from 'app/components/example.gts';
import myComponentCode from 'app/components/example.gts?raw';

<template>
  <MyComponent />

  Source code: {{myComponentCode}}
</template>

Docs: https://vite.dev/guide/assets#importing-asset-as-string

Hopefully helpful to others, and perhaps my future self.

(Should I PR into the README?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions