Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-03-10 20:12:11 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-03-11 16:13:03 +0300
commitdf298558a5a5b747288d9656402af85e0ac75a43 (patch)
treeed62ce971aeead7cf1833a8e9310dd69cbaa565f /commands
parentb1106f8715cac3544b8ea662b969336fe56fa047 (diff)
Improve Tailwind/PostCSS error messages
Fixes #7041 Fixes #7042
Diffstat (limited to 'commands')
-rw-r--r--commands/hugo.go14
-rw-r--r--commands/server.go1
-rw-r--r--commands/server_errors.go14
3 files changed, 16 insertions, 13 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index 4f7faaae4..841318685 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -722,9 +722,6 @@ func (c *commandeer) handleBuildErr(err error, msg string) {
func (c *commandeer) rebuildSites(events []fsnotify.Event) error {
defer c.timeTrack(time.Now(), "Total")
- defer func() {
- c.wasError = false
- }()
c.buildErr = nil
visited := c.visitedURLs.PeekAllSet()
@@ -886,6 +883,10 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher,
evs []fsnotify.Event,
configSet map[string]bool) {
+ defer func() {
+ c.wasError = false
+ }()
+
var isHandled bool
for _, ev := range evs {
@@ -1080,10 +1081,11 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher,
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
// force refresh when more than one file
- if len(staticEvents) == 1 {
+ if !c.wasError && len(staticEvents) == 1 {
ev := staticEvents[0]
path := c.hugo().BaseFs.SourceFilesystems.MakeStaticPathRelative(ev.Name)
path = c.firstPathSpec().RelURL(helpers.ToSlashTrimLeading(path), false)
+
livereload.RefreshPath(path)
} else {
livereload.ForceRefresh()
@@ -1107,6 +1109,10 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher,
if doLiveReload {
if len(partitionedEvents.ContentEvents) == 0 && len(partitionedEvents.AssetEvents) > 0 {
+ if c.wasError {
+ livereload.ForceRefresh()
+ return
+ }
changed := c.changeDetector.changed()
if c.changeDetector != nil && len(changed) == 0 {
// Nothing has changed.
diff --git a/commands/server.go b/commands/server.go
index a22a7a69a..f81708615 100644
--- a/commands/server.go
+++ b/commands/server.go
@@ -340,6 +340,7 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
if err != nil {
f.c.logger.ERROR.Println(err)
}
+
port = 1313
if !f.c.paused {
port = f.c.Cfg.GetInt("liveReloadPort")
diff --git a/commands/server_errors.go b/commands/server_errors.go
index 9f13c9d8c..7f467ee1c 100644
--- a/commands/server_errors.go
+++ b/commands/server_errors.go
@@ -30,8 +30,7 @@ var buildErrorTemplate = `<!doctype html>
body {
font-family: "Muli",avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 16px;
- background-color: black;
- color: rgba(255, 255, 255, 0.9);
+ background-color: #2f1e2e;
}
main {
margin: auto;
@@ -43,7 +42,7 @@ var buildErrorTemplate = `<!doctype html>
padding: 1rem 0;
}
.stack {
- margin-top: 6rem;
+ margin-top: 4rem;
}
pre {
white-space: pre-wrap;
@@ -54,10 +53,7 @@ var buildErrorTemplate = `<!doctype html>
}
.highlight {
overflow-x: auto;
- padding: 0.75rem;
margin-bottom: 1rem;
- background-color: #272822;
- border: 1px solid black;
}
a {
color: #0594cb;
@@ -70,14 +66,14 @@ var buildErrorTemplate = `<!doctype html>
</head>
<body>
<main>
- {{ highlight .Error "apl" "noclasses=true,style=monokai" }}
+ {{ highlight .Error "apl" "linenos=false,noclasses=true,style=paraiso-dark" }}
{{ with .File }}
- {{ $params := printf "noclasses=true,style=monokai,linenos=table,hl_lines=%d,linenostart=%d" (add .LinesPos 1) (sub .Position.LineNumber .LinesPos) }}
+ {{ $params := printf "noclasses=true,style=paraiso-dark,linenos=table,hl_lines=%d,linenostart=%d" (add .LinesPos 1) (sub .Position.LineNumber .LinesPos) }}
{{ $lexer := .ChromaLexer | default "go-html-template" }}
{{ highlight (delimit .Lines "\n") $lexer $params }}
{{ end }}
{{ with .StackTrace }}
- {{ highlight . "apl" "noclasses=true,style=monokai" }}
+ {{ highlight . "apl" "noclasses=true,style=paraiso-dark" }}
{{ end }}
<p class="version">{{ .Version }}</p>
<a href="">Reload Page</a>