Skip to content

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

Description

@andrewsuperlegit

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}}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions