giniedp / vscode-pug2html

Pug to html VSCode extension
4 stars 1 forks source link

obj compileOption is not working #4

Closed justin-calleja closed 7 years ago

justin-calleja commented 7 years ago

Given the following:

{
    "pug2html.compileOptions": {
        "basedir": "/Users/juca01/tmp-dir/tmpexpress",
        "pretty": true,
        "obj": "{ process: { env: { \"NODE_ENV\": \"production\" } } }"
    }
}

I'm expecting the contents of this condition to render:

if process.env.NODE_ENV === 'production'

But it isn't. It is if I use the compiler directly.

Thanks!

giniedp commented 7 years ago

obj ist not a compile option. At least it is not in the pug reference. https://pugjs.org/api/reference.html

Maybe you want to use self option instead? But then you have to refer to it as self.process.env.NODE_ENV

Here you can see how the i call the compiler https://github.com/giniedp/vscode-pug2html/blob/master/src/extension.ts#L84

How do you call the compiler directly?

justin-calleja commented 7 years ago

Hi @giniedp !

Sorry about that - I'm using pug-cli and assumed that the options I pass to it are directly passed to the compiler. It seems they're not from what you're telling me.

Thanks