<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>asset management on Hugo</title><link>https://v0-122-0--gohugoio.netlify.app/categories/asset-management/</link><description>Recent content in asset management on Hugo</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://v0-122-0--gohugoio.netlify.app/categories/asset-management/index.xml" rel="self" type="application/rss+xml"/><item><title>Hugo Pipes</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/introduction/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/introduction/</guid><description>Find resources in assets This is about global and remote resources.
global resource A file within the assets directory, or within any directory mounted to the assets directory. remote resource A file on a remote server, accessible via HTTP or HTTPS. For .Page scoped resources, see the page resources section.
Get a resource In order to process an asset with Hugo Pipes, it must be retrieved as a resource.
For global resources, use:</description></item><item><title>ToCSS</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/transpile-sass-to-css/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/transpile-sass-to-css/</guid><description>Usage Transpile Sass to CSS using the LibSass transpiler included in Hugo&amp;rsquo;s extended edition, or install Dart Sass to use the latest features of the Sass language.
{{ $opts := dict &amp;#34;transpiler&amp;#34; &amp;#34;libsass&amp;#34; &amp;#34;targetPath&amp;#34; &amp;#34;css/style.css&amp;#34; }} {{ with resources.Get &amp;#34;sass/main.scss&amp;#34; | toCSS $opts | minify | fingerprint }} &amp;lt;link rel=&amp;#34;stylesheet&amp;#34; href=&amp;#34;{{ .RelPermalink }}&amp;#34; integrity=&amp;#34;{{ .Data.Integrity }}&amp;#34; crossorigin=&amp;#34;anonymous&amp;#34;&amp;gt; {{ end }} Sass has two forms of syntax: SCSS and indented. Hugo supports both.</description></item><item><title>PostCSS</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/postcss/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/postcss/</guid><description>Setup Follow the steps below to transform CSS using any of the available PostCSS plugins.
Step 1 Install Node.js. Step 2 Install the required Node.js packages in the root of your project. For example, to add vendor prefixes to CSS rules: npm i -D postcss postcss-cli autoprefixer Step 3 Create a PostCSS configuration file in the root of your project. You must name this file postcss.config.js or one of the other supported file names.</description></item><item><title>PostProcess</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/postprocess/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/postprocess/</guid><description>Usage Marking a resource with resources.PostProcess delays any transformations to after the build, typically because one or more of the steps in the transformation chain depends on the result of the build (e.g. files in public).
A prime use case for this is CSS purging with PostCSS.
There are currently two limitations to this:
This only works in *.html templates (i.e. templates that produces HTML files).
You cannot manipulate the values returned from the resource&amp;rsquo;s methods.</description></item><item><title>js.Build</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/js/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/js/</guid><description>Usage Any JavaScript resource file can be transpiled and &amp;ldquo;tree shaken&amp;rdquo; using js.Build which takes for argument either a string for the filepath or a dict of options listed below.
Options targetPath (string) If not set, the source path will be used as the base target path. Note that the target path&amp;rsquo;s extension may change if the target MIME type is different, e.g. when the source is TypeScript. params New in v0.</description></item><item><title>Babel</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/babel/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/babel/</guid><description>Usage Any JavaScript resource file can be transpiled to another JavaScript version using resources.Babel which takes for argument the resource object and an optional dict of options listed below. Babel uses the babel cli.
Hugo Pipe&amp;rsquo;s Babel requires the @babel/cli and @babel/core JavaScript packages to be installed in the project or globally (npm install -g @babel/cli @babel/core) along with any Babel plugin(s) or preset(s) used (e.g., npm install @babel/preset-env --save-dev).</description></item><item><title>Minify</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/minification/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/minification/</guid><description>Usage Any CSS, JS, JSON, HTML, SVG, or XML resource can be minified using resources.Minify which takes for argument the resource object.
{{ $css := resources.Get &amp;#34;css/main.css&amp;#34; }} {{ $style := $css | resources.Minify }} Note that you can also minify the final HTML output to /public by running hugo --minify.</description></item><item><title>Concat</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/bundling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/bundling/</guid><description>Usage Asset files of the same MIME type can be bundled into one resource using resources.Concat which takes two arguments, the target path for the created resource bundle and a slice of resource objects to be concatenated.
{{ $plugins := resources.Get &amp;#34;js/plugins.js&amp;#34; }} {{ $global := resources.Get &amp;#34;js/global.js&amp;#34; }} {{ $js := slice $plugins $global | resources.Concat &amp;#34;js/bundle.js&amp;#34; }}</description></item><item><title>Fingerprint</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/fingerprint/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/fingerprint/</guid><description>Usage Fingerprinting and SRI can be applied to any asset file using resources.Fingerprint which takes two arguments, the resource object and an optional hash algorithm.
The default hash algorithm is sha256. Other available algorithms are sha384 and (as of Hugo 0.55) sha512 and md5.
Any so processed asset will bear a .Data.Integrity property containing an integrity string, which is made up of the name of the hash algorithm, one hyphen and the base64-encoded hash sum.</description></item><item><title>FromString</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/resource-from-string/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/resource-from-string/</guid><description>Usage It is possible to create a resource directly from the template using resources.FromString which takes two arguments, the target path for the created resource and the given content string.
The result is cached using the target path as the cache key.
The following example creates a resource file containing localized variables for every project&amp;rsquo;s languages.
{{ $string := (printf &amp;#34;var rootURL = &amp;#39;%s&amp;#39;; var apiURL = &amp;#39;%s&amp;#39;;&amp;#34; (absURL &amp;#34;/&amp;#34;) (.</description></item><item><title>ExecuteAsTemplate</title><link>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/resource-from-template/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/hugo-pipes/resource-from-template/</guid><description>Usage In order to use Hugo Pipes function on an asset file containing Go Template magic the function resources.ExecuteAsTemplate must be used.
The function takes three arguments: the target path for the created resource, the template context, and the resource object. The target path is used to cache the result.
// assets/sass/template.scss $backgroundColor: {{ .Param &amp;#34;backgroundColor&amp;#34; }}; $textColor: {{ .Param &amp;#34;textColor&amp;#34; }}; body{ background-color:$backgroundColor; color: $textColor; } // [...] {{ $sassTemplate := resources.</description></item></channel></rss>