1

Using ufront and erazor I ran into the following problem very quickly. The hello-world example provides the following layout:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>@title</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
</head>
<body>
    <div class="container">
        @viewContent
    </div>
</body>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"</script>
</html>

For certain pages I want to add more headers or scripts after Jquery has been loaded.

One way to do so (for the scripts for example), would be to pass the scripts as an array of strings, and construct them on the layout file :

...
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"</script>
@for(script in scripts) {
    <script src='@script.path'></script>
}
</html>
....

The problem with this approach is that I can't keep meaningful headers + body + scripts on the same template file witch would be great, also needs extra care to pass the scripts and headers as context.

Some template engines like Razor or Laravel allow to do that using 'sections'.
Is it possible to do something similar with erazor? If not what would be a good alternative?

Gama11
  • 31,714
  • 9
  • 78
  • 100
TiagoLr
  • 2,782
  • 22
  • 16
  • I could reformulate this question to: is it possible to add partials or sections when using ufront and erazor? – TiagoLr Dec 15 '14 at 00:31
  • There is a little discussion going on about sections using ufront and erazor. https://github.com/ufront/ufront/issues/9 - might be interesting for you. – michaPau May 05 '15 at 16:30

0 Answers0