mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Merge commit '00c4484c7092181729f6f470805bc7d72e8ad17b'
This commit is contained in:
@@ -4,7 +4,6 @@ linkTitle: Resource from Template
|
||||
description: Hugo Pipes allows the creation of a resource from an asset file using Go Template.
|
||||
date: 2018-07-14
|
||||
publishdate: 2018-07-14
|
||||
lastmod: 2018-07-14
|
||||
categories: [asset management]
|
||||
keywords: []
|
||||
menu:
|
||||
@@ -13,7 +12,6 @@ menu:
|
||||
weight: 80
|
||||
weight: 80
|
||||
sections_weight: 80
|
||||
draft: false
|
||||
---
|
||||
|
||||
In order to use Hugo Pipes function on an asset file containing Go Template magic the function `resources.ExecuteAsTemplate` must be used.
|
||||
@@ -25,13 +23,12 @@ The function takes three arguments: the resource target path, the template conte
|
||||
$backgroundColor: {{ .Param "backgroundColor" }};
|
||||
$textColor: {{ .Param "textColor" }};
|
||||
body{
|
||||
background-color:$backgroundColor;
|
||||
color: $textColor;
|
||||
background-color:$backgroundColor;
|
||||
color: $textColor;
|
||||
}
|
||||
// [...]
|
||||
```
|
||||
|
||||
|
||||
```go-html-template
|
||||
{{ $sassTemplate := resources.Get "sass/template.scss" }}
|
||||
{{ $style := $sassTemplate | resources.ExecuteAsTemplate "main.scss" . | resources.ToCSS }}
|
||||
|
Reference in New Issue
Block a user