Skip to content

feat(templates): allow selecting the compiler per <template> #1645

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

Closed
wants to merge 3 commits into from
Closed

feat(templates): allow selecting the compiler per <template> #1645

wants to merge 3 commits into from

Conversation

basvanmeurs
Copy link

This is to allow multiple renderers to be used within the same Vue app. In particular, I am building a WebGL/Canvas2d renderer for the vue3 api. It enables the developer to write a part of the app in HTML DOM, and another part in WebGL.

Example usage:
webpack.config.js:

      {
        test: /\.vue$/,
        use: {
          loader: 'vue-loader',
          options: {
            templateCompilers: {
              vugel: {compiler: require('vugel'), compilerOptions: {}}
            }
          }
        }

Comp.vue:

<template compiler="vugel">
  <node :scale="prop">
    <rect v-for="(item,index) in images" :x="item.x" :w="item.w" :y="index * 40" :h="20" :color="0xff00ffff">
    </rect>
  </node>
</template>

Copy link
Member

@yyx990803 yyx990803 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the option format to use Babel config style options:

options: {
  compilerOptions: { /* options for default compiler */ },
  customCompilers: {
    vugel: [require('vugel'), { /* vugel compiler options */ }],
    foobar: require('foobar-compiler') // shorthand no options
  }
}

@basvanmeurs basvanmeurs requested a review from yyx990803 April 30, 2020 07:42
@RobbinBaauw RobbinBaauw deleted the feat/multiple-compilers branch June 30, 2020 13:48
@RobbinBaauw RobbinBaauw restored the feat/multiple-compilers branch June 30, 2020 13:49
@RobbinBaauw
Copy link

@yyx990803 could you maybe take another look at this? Thanks!

@SaFrMo
Copy link

SaFrMo commented Jul 4, 2021

I'm looking into making a custom renderer for TroisJS and am running into a similar issue with needing to use multiple renderers - would love a feature like this to combine HTML and ThreeJS components easily!

@Korijn
Copy link

Korijn commented Jun 17, 2022

Is this still on the roadmap?

@Planning-nl Planning-nl closed this by deleting the head repository May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants