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

keep dynamic values in rendered template #11

Open
wendt88 opened this issue Oct 23, 2017 · 5 comments
Open

keep dynamic values in rendered template #11

wendt88 opened this issue Oct 23, 2017 · 5 comments

Comments

@wendt88
Copy link

wendt88 commented Oct 23, 2017

is there a possibility to keep the variables (rendered on time by e.g. express)?

html(lang=language)
    head
        title= title
        meta(charset="utf-8")
        meta(name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no")
    body

I need this layout where language and title should be dynamic values

@negibouze
Copy link
Owner

Thank you for your message.
I'm sorry, I have no time now, so I will check later.

@negibouze
Copy link
Owner

Isn't this the output you are expecting?

doctype html
html(lang=language)
  head
    title= title
    meta(charset="utf-8")
    meta(name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no")
    link(href="styles.css" rel="stylesheet")
  body
    script(type="text/javascript" src="bundle.js")

If not, could you please describe the output you are expecting?

@wendt88
Copy link
Author

wendt88 commented Oct 25, 2017

I tried a bit and the problem was, that i had set a title property in my HtmlWebpackPlugin options, so it made a replace.

I'm trying now to seperate my pug files in one layout and some template files like:
a.pug, b.pug & c.pug:

extends layout
block content
    div ...

layout.pug:

doctype html
html(lang=language)
    head
        title= title
        meta(charset="utf-8")
    body
        block content

the result is: webpack does not combine those files, so in the output folder there are only the templatefiles with the same content (without layout & chunks etc)

@negibouze
Copy link
Owner

Thank you for your response.
I will check again.

@negibouze
Copy link
Owner

Sorry for the late reply.

I thought about a solution, but it is difficult to handle 'extends' with this plugin.

It may work well if there is a loader that only solves 'extends'.
But I could not find it.
It does not work well with loader that converts to HTML like 'pug-loader'.

If all files (a.pug, b.pug & c.pug) use the same js file, insert it in layout.pug and solving 'extends' with 'express' etc, It may work well.

I am sorry that I can not solve your problem.

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

2 participants