Skip to content

Looking for example project that uses pug-cli #72

Open
@wgehner

Description

@wgehner

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."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions