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

Looking for example project that uses pug-cli #72

Open
wgehner opened this issue Apr 6, 2018 · 0 comments
Open

Looking for example project that uses pug-cli #72

wgehner opened this issue Apr 6, 2018 · 0 comments

Comments

@wgehner
Copy link

wgehner commented Apr 6, 2018

Anyone know of a published example project that uses pug-cli?

Ideally, one that does this:

https://stackoverflow.com/questions/43025557/client-side-templating-with-nodejs-and-pug

"I modified my npm start script to do the following:

pug -c -w --name-after-file -o public/js/views views/client/

What this allows me to do is write my client views in put in the views/client folder. A task is running in the background that monitors changes in views/client/. Upon changes, it complies .pug files from views/client/ folder into javascript and saves it into public/js/views/. Then in the client code you just include Template.js and call Template(parameters) in your js. There is no need for a pug.js on client side. This is with debugging, to turn debug off, run with -D

For instance, views/client/example.pug will get automatically complied to public/js/views/exampleTemplate.js Then all you have to do in the client is include this js file, and call exampleTemplate(params) to get your templated string (you can call this arbitrarily with different parameters get different views). This allows me to arbitrarily/dynamically compose and construct views from the client, when the views are unknown on the server side."

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