Skip to content
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

Is it possible to use webpack's rawloader to feed this plugin template files as strings? #143

Open
andrewsuperlegit opened this issue Aug 10, 2021 · 0 comments

Comments

@andrewsuperlegit
Copy link

andrewsuperlegit commented Aug 10, 2021

I'm using threejs/react-three-fiber and this works:

const VideoElem = ()=>{
  const sphereArgs = {
    args: [500,60,40],
    scale: [-1,1,1],
    position: [0,0,0]
  }

  return pug`
mesh
    sphereGeometry(args=${sphereArgs.args} scale=${sphereArgs.scale} position=${sphereArgs.position}
        meshBasicMaterial
            videoTexture(attach="map" args=${video}
`
}

But these do not:

import videoelem from 'videoelem.pug?raw';

const VideoElem = (){
...
...
// pug keeps this as a string, but as the correct string-- like if this were passed to a pug compile function i'm pretty sure it'd do fine
return pug`${videoelem}`

// this just would print out videoelem because it's treating it as a string
return pug`videoelem`

// this fails because apparently the `` isn't a string even though it's a string?
return pug``.concat(videoelem)
}
...

I don't get it.
... I have a string that this plugin could totally compile if I could just figure out how to pass it to this pug`` ... function?

It seems so close. Is there a way to pass a string along to this pug transformer thing? Like

let string = 'div.derp'

pug`${{string}}`
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

No branches or pull requests

1 participant