mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
dea71670c0
Before this commit, you would have to use page bundles to do image processing etc. in Hugo. This commit adds * A new `/assets` top-level project or theme dir (configurable via `assetDir`) * A new template func, `resources.Get` which can be used to "get a resource" that can be further processed. This means that you can now do this in your templates (or shortcodes): ```bash {{ $sunset := (resources.Get "images/sunset.jpg").Fill "300x200" }} ``` This also adds a new `extended` build tag that enables powerful SCSS/SASS support with source maps. To compile this from source, you will also need a C compiler installed: ``` HUGO_BUILD_TAGS=extended mage install ``` Note that you can use output of the SCSS processing later in a non-SCSSS-enabled Hugo. The `SCSS` processor is a _Resource transformation step_ and it can be chained with the many others in a pipeline: ```bash {{ $css := resources.Get "styles.scss" | resources.ToCSS | resources.PostCSS | resources.Minify | resources.Fingerprint }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Digest }}" media="screen"> ``` The transformation funcs above have aliases, so it can be shortened to: ```bash {{ $css := resources.Get "styles.scss" | toCSS | postCSS | minify | fingerprint }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Digest }}" media="screen"> ``` A quick tip would be to avoid the fingerprinting part, and possibly also the not-superfast `postCSS` when you're doing development, as it allows Hugo to be smarter about the rebuilding. Documentation will follow, but have a look at the demo repo in https://github.com/bep/hugo-sass-test New functions to create `Resource` objects: * `resources.Get` (see above) * `resources.FromString`: Create a Resource from a string. New `Resource` transformation funcs: * `resources.ToCSS`: Compile `SCSS` or `SASS` into `CSS`. * `resources.PostCSS`: Process your CSS with PostCSS. Config file support (project or theme or passed as an option). * `resources.Minify`: Currently supports `css`, `js`, `json`, `html`, `svg`, `xml`. * `resources.Fingerprint`: Creates a fingerprinted version of the given Resource with Subresource Integrity.. * `resources.Concat`: Concatenates a list of Resource objects. Think of this as a poor man's bundler. * `resources.ExecuteAsTemplate`: Parses and executes the given Resource and data context (e.g. .Site) as a Go template. Fixes #4381 Fixes #4903 Fixes #4858
171 lines
3.1 KiB
TOML
171 lines
3.1 KiB
TOML
|
|
|
|
[[constraint]]
|
|
name = "github.com/BurntSushi/toml"
|
|
branch = "master"
|
|
|
|
[[constraint]]
|
|
name = "github.com/PuerkitoBio/purell"
|
|
version = "1.1.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/alecthomas/chroma"
|
|
revision = "1b755a90bd109f170385cb3964f0abdfd3451145"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/bep/gitmap"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/bep/go-tocss"
|
|
|
|
[[override]]
|
|
branch = "master"
|
|
name = "github.com/wellington/go-libsass"
|
|
|
|
[[constraint]]
|
|
name = "github.com/chaseadamsio/goorgeous"
|
|
version = "^1.1.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/disintegration/imaging"
|
|
version = "~v1.2.4"
|
|
|
|
[[constraint]]
|
|
name = "github.com/magefile/mage"
|
|
version = "v1"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/eknkc/amber"
|
|
|
|
[[constraint]]
|
|
name = "github.com/fortytw2/leaktest"
|
|
version = "1.1.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/fsnotify/fsnotify"
|
|
version = "^1.4.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/gorilla/websocket"
|
|
version = "1.2.0"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/hashicorp/go-immutable-radix"
|
|
|
|
[[constraint]]
|
|
name = "github.com/jdkato/prose"
|
|
version = "1.1.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/kyokomi/emoji"
|
|
version = "1.5.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/markbates/inflect"
|
|
revision = "a12c3aec81a6a938bf584a4bac567afed9256586"
|
|
|
|
[[constraint]]
|
|
name = "github.com/miekg/mmark"
|
|
version = "^1.3.6"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/mitchellh/mapstructure"
|
|
|
|
[[constraint]]
|
|
name = "github.com/nicksnyder/go-i18n"
|
|
version = "^1.10.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/russross/blackfriday"
|
|
branch = "master"
|
|
|
|
[[constraint]]
|
|
name = "github.com/spf13/afero"
|
|
version = "^1.1.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/spf13/cast"
|
|
version = "^1.1.0"
|
|
|
|
[[constraint]]
|
|
version = "^0.0.1"
|
|
name = "github.com/spf13/cobra"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/spf13/fsync"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/spf13/jwalterweatherman"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/spf13/nitro"
|
|
|
|
[[constraint]]
|
|
name = "github.com/spf13/pflag"
|
|
version = "1.0.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/spf13/viper"
|
|
version = "1.0.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/stretchr/testify"
|
|
version = "1.1.4"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/olekukonko/tablewriter"
|
|
|
|
[[constraint]]
|
|
name = "github.com/yosssi/ace"
|
|
version = "^0.0.5"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "golang.org/x/image"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "golang.org/x/text"
|
|
|
|
[[constraint]]
|
|
branch = "v2"
|
|
name = "gopkg.in/yaml.v2"
|
|
|
|
[[constraint]]
|
|
name = "github.com/gobwas/glob"
|
|
version = "0.2.2"
|
|
|
|
|
|
[[constraint]]
|
|
name = "github.com/muesli/smartcrop"
|
|
branch = "master"
|
|
|
|
|
|
[[constraint]]
|
|
name = "github.com/sanity-io/litter"
|
|
version = "1.1.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/bep/debounce"
|
|
version = "^1.1.0"
|
|
|
|
[[constraint]]
|
|
name = "github.com/tdewolff/minify"
|
|
version = "^2.3.5"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/BurntSushi/locker"
|
|
|
|
[[constraint]]
|
|
branch = "master"
|
|
name = "github.com/mitchellh/hashstructure"
|