github.com/jbramsden/hugo@v0.47.1/docs/content/en/hugo-pipes/introduction.md (about)

     1  ---
     2  title: Hugo Pipes Introduction
     3  description: Hugo Pipes is Hugo's asset processing set of functions.
     4  date: 2018-07-14
     5  publishdate: 2018-07-14
     6  lastmod: 2018-07-14
     7  categories: [asset management]
     8  keywords: []
     9  menu:
    10    docs:
    11      parent: "pipes"
    12      weight: 20
    13  weight: 01
    14  sections_weight: 01
    15  draft: false
    16  aliases: [/assets/]
    17  --- 
    18  
    19  ### Asset directory
    20  
    21  Asset files must be stored in the asset directory. This is `/assets` by default, but can be configured via the configuration file's `assetDir` key.
    22  
    23  ### From file to resource
    24  
    25  In order to process an asset with Hugo Pipes, it must be retrieved as a resource using `resources.Get`, which takes one argument: the filepath of the file relative to the asset directory.
    26  
    27  ```go-html-template
    28  {{ $style := resources.Get "sass/main.scss" }}
    29  ```
    30  
    31  ### Asset publishing
    32  
    33  Assets will only be published (to `/public`) if `.Permalink` or `.RelPermalink` is used.
    34  
    35  ### Go Pipes
    36  
    37  For improved readability, the Hugo Pipes examples of this documentation will be written using [Go Pipes](/templates/introduction/#pipes):
    38  ```go-html-template
    39  {{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
    40  <link rel="stylesheet" href="{{ $style.Permalink }}">
    41  ```
    42  
    43  ### Method aliases
    44  
    45  Each Hugo Pipes `resources` transformation method uses a __camelCased__ alias (`toCSS` for `resources.ToCSS`).
    46  Non-transformation methods deprived of such aliases are `resources.Get`, `resources.FromString`, `resources.ExecuteAsTemplate` and `resources.Concat`.
    47  
    48  The example above can therefore also be written as follows:
    49  ```go-html-template
    50  {{ $style := resources.Get "sass/main.scss" | toCSS | minify | fingerprint }}
    51  <link rel="stylesheet" href="{{ $style.Permalink }}">
    52  ```