aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform
AgeCommit message (Collapse)Author
2022-08-07livereload: Inject script without head or body tagsatotake
Currently, Hugo does not inject `livereload` script if html does not contain `<head>` or `<body>`. This sometimes happens if you create new sites without `theme` and it is hard to catch the cause soon. This PR: * Inject livereload script even if html does not include `<head>`, `<body>`, or `<html>` - Modern browsers execute scripts even if they are outside `<html>` - Some js frameworks (confirmed with vite) inject HRM script without `<html>` tag * Append warning script to html if `<head>` or `<body>` is not in html * Fix bug that livereload cannot be appended to the tags with attrs Close #10105
2022-05-15Improve SASS errorsBjørn Erik Pedersen
Fixes #9897
2022-05-15postcss: Fix import error handlingBjørn Erik Pedersen
Note that we will now fail if `inlineImports` is enabled and we cannot resolve an import. You can work around this by either: * Use url imports or imports with media queries. * Set `skipInlineImportsNotFound=true` in the options Also get the argument order in the different NewFileError* funcs in line. Fixes #9895
2022-05-06Improve error messages, esp. when the server is runningBjørn Erik Pedersen
* Add file context to minifier errors when publishing * Misc fixes (see issues) * Allow custom server error template in layouts/server/error.html To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go. Fixes #9852 Fixes #9857 Fixes #9863
2022-03-17all: gofmt -w -r 'interface{} -> any' .Bjørn Erik Pedersen
Updates #9687
2020-12-16all: Fix minor typosPhil Davis
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-12-02Use --baseURL path for live-reload URLsth
Fixes #6595
2020-09-09Encode & in livereload injected codeRalph Slooten
2020-06-14Fix aliases with relativeURLsHelder Pereira
2020-01-31transform/livereloadinject: Add defer to livereload script tagBjørn Erik Pedersen
In #6821 we moved the loading from end of body to head to make Turbolinks and similar work. This commit adds a defer attribute to avoid page parse blocking.
2020-01-31transform/livereloadinject: Don't use document.write to inject livereloadBjørn Erik Pedersen
I suspect the person who originally implemented it saw examples using location.host etc. to build the URL. We have all that information ready at build (static) time. Fixes #6507
2020-01-29transform/livereloadinject: Inject livereload script right after head if ↵Bjørn Erik Pedersen
possible We used to insert the livereload script right before the closing body. This dord not work when combined with tools such as Turbolinks. This commit changes it So we try to inject the script as early as possible. Fixes #6821
2019-08-12tests: Convert from testify to quicktestBjørn Erik Pedersen
2019-08-06 transform/urlreplacers: Cache the next position of `urlreplacer.prefix`HyeonGyu Lee
Improved performance due to `bytes.Index` repeated calls Fixes #5942
2019-07-24Add Hugo ModulesBjørn Erik Pedersen
This commit implements Hugo Modules. This is a broad subject, but some keywords include: * A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project. * A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects. * Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running. * Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions. * A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`. All of the above is backed by Go Modules. Fixes #5973 Fixes #5996 Fixes #6010 Fixes #5911 Fixes #5940 Fixes #6074 Fixes #6082 Fixes #6092
2019-07-22Fix livereload for @import caseBjørn Erik Pedersen
Fixes #6106
2019-03-24all: Apply staticcheck recommendationsBjørn Erik Pedersen
2019-03-23Run gofmt -sBjørn Erik Pedersen
2019-02-26Rewrite relative action URLSBerin Larson
Fixes #5701
2018-12-17transform/urlreplacers: Simplify implementationBjørn Erik Pedersen
2018-12-17transform/urlreplacers: Support unquoted URLs in canonifyURLs replacerBjørn Erik Pedersen
Fixes #5529
2018-12-06Add tpl/site and tpl/hugoBjørn Erik Pedersen
This means that the current `.Site` and ´.Hugo` is available as a globals, so you can do `site.IsServer`, `hugo.Version` etc. Fixes #5470 Fixes #5467 Fixes #5503
2018-08-06Add support for minification of final outputBjørn Erik Pedersen
Hugo Pipes added minification support for resources fetched via ´resources.Get` and similar. This also adds support for minification of the final output for supported output formats: HTML, XML, SVG, CSS, JavaScript, JSON. To enable, run Hugo with the `--minify` flag: ```bash hugo --minify ``` This commit is also a major spring cleaning of the `transform` package to allow the new minification step fit into that processing chain. Fixes #1251
2018-08-05transform: Reduce allocation in the benchmark itselfBjørn Erik Pedersen
2018-08-05transform: Simplify the 0 transformer caseBjørn Erik Pedersen
2017-08-03Add some missing doc commentsJorin Vogel
As pointed out by the linter, some exported functions and types are missing doc comments. The linter warnings have been reduced from 194 to 116. Not all missing comments have been added in this commit though.
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-04-24Automate the Hugo release processBjørn Erik Pedersen
This commit adds a work flow aroung GoReleaser to get the Hugo release process automated and more uniform: * It can be run fully automated or in two steps to allow for manual edits of the relase notes. * It supports both patch and full releases. * It fetches author, issue, repo info. etc. for the release notes from GitHub. * The file names produced are mainly the same as before, but we no use tar.gz as archive for all Unix versions. * There isn't a fully automated CI setup in place yet, but the release tag is marked in the commit message with "[ci deploy]" Fixes #3358
2017-04-06all: Handle all errorsBjørn Erik Pedersen
As reported by `errcheck`.
2017-02-17all: Refactor to nonglobal Viper, i18n etc.Bjørn Erik Pedersen
This is a final rewrite that removes all the global state in Hugo, which also enables the use if `t.Parallel` in tests. Updates #2701 Fixes #3016
2016-11-23transform: SimplifyBjørn Erik Pedersen
2016-11-04transform: Return any read or write error from ApplyBjørn Erik Pedersen
2016-07-06transform: Add missing GoDocBjørn Erik Pedersen
2016-06-30transform: Explicitly bind LiveReload to server portDragos Plesca
If hugo server is run on port 80 or 443, LiveReload does not correctly bind to the same port, instead using port 35729. This commit adds functionality to inform LiveReload of the correct port to bind to. See https://github.com/livereload/livereload-js/issues/16 Partially contributed by Jeff Minard (@chuyskywalker). Fixes #2205
2016-06-25transform: Don't use helpers.StringToReaderCameron Moore
2016-06-25helpers: Remove ToReader funcsCameron Moore
Remove StringToReader and BytesToReader in favor of using the stdlib directly.
2016-06-04Add Hugo generator tag to home page if not presentBjørn Erik Pedersen
Fixes #2182
2016-03-23transform: Group vars and consts in chain_testBjørn Erik Pedersen
2016-03-23transform: Clean up the var naming mess in chain_testBjørn Erik Pedersen
2016-03-23transform: Golint fixesBjørn Erik Pedersen
2016-03-14Remove unnecessary type conversionsBjørn Erik Pedersen
2016-03-14transform: Remove unused codeBjørn Erik Pedersen
2016-02-06transform: Complete test statement coverageBjørn Erik Pedersen
"coverage: 100.0% of statements"
2016-02-06Only do one livereload replacementBjørn Erik Pedersen
2016-02-06transform: Add missing test case in livereloadinjectBjørn Erik Pedersen
* Test for both </body> and </BODY> * This also cosmetically changes the behaviour, as the case of the end body tag is kept.
2016-02-06transform: Add missing test case for NewEmptyTransformsBjørn Erik Pedersen
2015-12-10Add copyright header to that source files that don’t have one.Anthony Fok
See #1646
2015-10-15Load livereload.js from "/"Kato Kazuyoshi
Fix #1406 Instead of loading the file from http://localhost:port/, it can be loaded from /.
2015-05-25Apply gofmt -sbep