kirbysayshi/vash

[VASHMARK-yyyyyy:block-xxxxxx] ???

Closed this issue · 4 comments

[VASHMARK-8635239:block-xxxxxx] ???

my expectation:

<html>
    <head>
        <script>'Page script'</script>
        <script>'Component script'</script>
    </head>
    <body>
        <div>
            <p>Hello!</p>
        </div>
    </body>
</html>

but actually:

<html>
    <head>
        [VASHMARK-8635239:block-scripts]
    </head>
    <body>
        [VASHMARK-2927565:block-content]
    </body>
</html>

My code:

main.js:

var vash = require('vash');
var fs = require('fs');

var pageText = fs.readFileSync('page.vash').toString();
var page = vash.compile(pageText);
console.log(page());

page.vash:

@html.extend('layout.vash', function(model) {
    @html.block('scripts', function() {
        <script>'Page script'</script>
    })

    @html.block('content', function() {
        <div>
            @html.include('component.vash')
        </div>
    })
})

component.vash:

@html.append('scripts', function() {
    <script>'Component script'</script>
})

<p>Hello!</p>

layout.vash:

<html>
    <head>
        @html.block('scripts')
    </head>
    <body>
        @html.block('content')
    </body>
</html>

😕

What was the issue?

I'm getting a similar issue @fghhfg , did you fix it?

I figured it out: I was apparently generating static content like this guy: #35 (comment)

I didn't really know that this wasn't supported. Maybe you add that to the readme somewhere, I'm sure other people have ran in to the same problem.

Ah, sorry @blenderer. The layout helpers were designed to be mostly used with express, so not documenting the finishLayout method is definitely an oversight on my part.