Can I use browser? #2655

Closed
uk-taniyama opened this Issue Dec 29, 2016 · 6 comments

Comments

Projects
None yet
5 participants
@uk-taniyama

I cannot found pug at cdn.
So I want to build by browserify.
BUT some error occurred.

As a result of various experiments, it was solved by applying a patch to the file under "pug".
See my git for details.
https://github.com/uk-taniyama/pug-for-browser

@strugee

This comment has been minimized.

Show comment
Hide comment
@strugee

strugee Feb 14, 2017

I'm unclear on what you want the project to do. This is not a supported way for running Pug in the browser.

See https://pugjs.org/api/reference.html#pugcompilefileclientpath-options

strugee commented Feb 14, 2017

I'm unclear on what you want the project to do. This is not a supported way for running Pug in the browser.

See https://pugjs.org/api/reference.html#pugcompilefileclientpath-options

@kylecordes

This comment has been minimized.

Show comment
Hide comment
@kylecordes

kylecordes Feb 26, 2017

The ability to execute in the browser would be a fantastic feature for Pug. One use case I would use often: a development-time compile-run cycle which executes entirely in a browser (no server side process needed), plus a production-build process that does it all in advance instead.

The ability to execute in the browser would be a fantastic feature for Pug. One use case I would use often: a development-time compile-run cycle which executes entirely in a browser (no server side process needed), plus a production-build process that does it all in advance instead.

@ForbesLindesay

This comment has been minimized.

Show comment
Hide comment
@ForbesLindesay

ForbesLindesay Feb 26, 2017

Member

I recommend using a build process in development. You can use whichever build tool you want:

  • gulp
  • browserify
  • webpack
  • etc.
Member

ForbesLindesay commented Feb 26, 2017

I recommend using a build process in development. You can use whichever build tool you want:

  • gulp
  • browserify
  • webpack
  • etc.
@jameslaydigital

This comment has been minimized.

Show comment
Hide comment
@jameslaydigital

jameslaydigital Jul 20, 2017

I can think of several excellent examples of why you would want to do this. First, you don't actually HAVE access to the server environment b/c you use a PaaS like firebase, and all your source code is static html files. Another reason is that you're trying to use a templating engine at work but your boss doesn't want you installing more software on the server. Perhaps your server is an IBM500 that doesn't support node, npm, or a language which has implemented pug. I could keep going, but the point is that there are many reasons you may want to do this on the client. My personal reason is that PHP's pug implementation is taking 3-4 seconds to render a very small pug template and I'm pretty sure it would be faster to just do it on the client.

I can think of several excellent examples of why you would want to do this. First, you don't actually HAVE access to the server environment b/c you use a PaaS like firebase, and all your source code is static html files. Another reason is that you're trying to use a templating engine at work but your boss doesn't want you installing more software on the server. Perhaps your server is an IBM500 that doesn't support node, npm, or a language which has implemented pug. I could keep going, but the point is that there are many reasons you may want to do this on the client. My personal reason is that PHP's pug implementation is taking 3-4 seconds to render a very small pug template and I'm pretty sure it would be faster to just do it on the client.

@strugee

This comment has been minimized.

Show comment
Hide comment
@strugee

strugee Jul 20, 2017

@jameslaydigital did you read the link I posted above? Pug has had the ability to compile for browser usage for a long time - just not in the way OP was asking about.

strugee commented Jul 20, 2017

@jameslaydigital did you read the link I posted above? Pug has had the ability to compile for browser usage for a long time - just not in the way OP was asking about.

@ForbesLindesay

This comment has been minimized.

Show comment
Hide comment
@ForbesLindesay

ForbesLindesay Sep 6, 2017

Member

@jameslaydigital All the suggestions I posted could be used on the developer's machine if need be, before sending the code to a PaaS like firebase, or copying it onto corporate servers.

Member

ForbesLindesay commented Sep 6, 2017

@jameslaydigital All the suggestions I posted could be used on the developer's machine if need be, before sending the code to a PaaS like firebase, or copying it onto corporate servers.

@pugjs pugjs locked and limited conversation to collaborators Sep 6, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.