diff --git a/content/en/functions/js/Babel.md b/content/en/functions/js/Babel.md
index 9485b4d05..f5b54a3b0 100644
--- a/content/en/functions/js/Babel.md
+++ b/content/en/functions/js/Babel.md
@@ -3,31 +3,34 @@ title: js.Babel
description: Compiles the given JavaScript resource with Babel.
categories: []
keywords: []
-weight: 100
action:
- aliases: [babel,/hugo-pipes/babel/]
+ aliases: [babel]
related:
+ - functions/js/Batch
- functions/js/Build
- functions/resources/Fingerprint
- functions/resources/Minify
returnType: resource.Resource
signatures: ['js.Babel [OPTIONS] RESOURCE']
+weight: 30
toc: true
---
-{{< new-in 0.128.0 >}}
-
```go-html-template
{{ with resources.Get "js/main.js" }}
- {{ if hugo.IsDevelopment }}
- {{ with . | babel }}
+ {{ $opts := dict
+ "minified" hugo.IsProduction
+ "noComments" hugo.IsProduction
+ "sourceMap" (cond hugo.IsProduction "none" "external")
+ }}
+ {{ with . | js.Babel $opts }}
+ {{ if hugo.IsProduction }}
+ {{ with . | fingerprint }}
+
+ {{ end }}
+ {{ else }}
{{ end }}
- {{ else }}
- {{ $opts := dict "minified" true }}
- {{ with . | babel $opts | fingerprint }}
-
- {{ end }}
{{ end }}
{{ end }}
```
@@ -72,20 +75,32 @@ module.exports = {
## Options
-config
-: (`string`) Path to the Babel configuration file. Hugo will, by default, look for a `babel.config.js` in your project. More information on these configuration files can be found here: [babel configuration](https://babeljs.io/docs/en/configuration).
+###### compact
-minified
-: (`bool`) Save as many bytes as possible when printing
+(`bool`) Whether to remove optional newlines and whitespace. Enabled when `minified` is `true`. Default is `false`
-noComments
-: (`bool`) Write comments to generated output (true by default)
+###### config
-compact
-: (`bool`) Do not include superfluous whitespace characters and line terminators. Defaults to `auto` if not set.
+(`string`) Path to the Babel configuration file. Hugo will, by default, look for a `babel.config.js` file in the root of your project. See [details](https://babeljs.io/docs/en/configuration).
-verbose
-: (`bool`) Log everything
+###### minified
-sourceMap
-: (`string`) Output `inline` or `external` sourcemap from the babel compile. External sourcemaps will be written to the target with the output file name + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps.
+(`bool`) Whether to minify the compiled code. Enables the `compact` option. Default is `false`.
+
+###### noBabelrc
+
+(`string`) Whether to ignore `.babelrc` and `.babelignore` files. Default is `false`.
+
+###### noComments
+
+(`bool`) Whether to remove comments. Default is `false`.
+
+###### sourceMap
+
+(`string`) Whether to generate source maps, one of `external`, `inline`, or `none`. Default is `none`.
+
+
+
+###### verbose
+
+(`bool`) Whether to enable verbose logging. Default is `fasle`
diff --git a/content/en/functions/js/Batch.md b/content/en/functions/js/Batch.md
index fbc1c7e61..08913f61f 100644
--- a/content/en/functions/js/Batch.md
+++ b/content/en/functions/js/Batch.md
@@ -1,7 +1,6 @@
---
title: js.Batch
description: Build JavaScript bundle groups with global code splitting and flexible hooks/runners setup.
-weight: 50
categories: []
keywords: []
action:
@@ -13,6 +12,7 @@ action:
- functions/resources/Minify
returnType: js.Batcher
signatures: ['js.Batch [ID]']
+weight: 20
toc: true
---
diff --git a/content/en/functions/js/Build.md b/content/en/functions/js/Build.md
index 4829f3b83..56118213f 100644
--- a/content/en/functions/js/Build.md
+++ b/content/en/functions/js/Build.md
@@ -1,17 +1,18 @@
---
title: js.Build
description: Bundles, transpiles, tree shakes, and minifies JavaScript resources.
-weight: 30
categories: []
keywords: []
action:
aliases: []
related:
+ - functions/js/Batch
- functions/js/Babel
- functions/resources/Fingerprint
- functions/resources/Minify
returnType: resource.Resource
signatures: ['js.Build [OPTIONS] RESOURCE']
+weight: 10
toc: true
---
diff --git a/content/en/functions/resources/Babel.md b/content/en/functions/resources/Babel.md
index 3e98ba3fe..59c6e636c 100644
--- a/content/en/functions/resources/Babel.md
+++ b/content/en/functions/resources/Babel.md
@@ -5,6 +5,7 @@ categories: []
keywords: []
action:
related:
+ - functions/js/Batch
- functions/js/Build
- functions/resources/Fingerprint
- functions/resources/Minify
@@ -22,15 +23,19 @@ Use [`js.Babel`] instead.
```go-html-template
{{ with resources.Get "js/main.js" }}
- {{ if hugo.IsDevelopment }}
- {{ with . | babel }}
+ {{ $opts := dict
+ "minified" hugo.IsProduction
+ "noComments" hugo.IsProduction
+ "sourceMap" (cond hugo.IsProduction "none" "external")
+ }}
+ {{ with . | js.Babel $opts }}
+ {{ if hugo.IsProduction }}
+ {{ with . | fingerprint }}
+
+ {{ end }}
+ {{ else }}
{{ end }}
- {{ else }}
- {{ $opts := dict "minified" true }}
- {{ with . | babel $opts | fingerprint }}
-
- {{ end }}
{{ end }}
{{ end }}
```
@@ -75,20 +80,32 @@ module.exports = {
## Options
-config
-: (`string`) Path to the Babel configuration file. Hugo will, by default, look for a `babel.config.js` in your project. More information on these configuration files can be found here: [babel configuration](https://babeljs.io/docs/en/configuration).
+###### compact
-minified
-: (`bool`) Save as many bytes as possible when printing
+(`bool`) Whether to remove optional newlines and whitespace. Enabled when `minified` is `true`. Default is `false`
-noComments
-: (`bool`) Write comments to generated output (true by default)
+###### config
-compact
-: (`bool`) Do not include superfluous whitespace characters and line terminators. Defaults to `auto` if not set.
+(`string`) Path to the Babel configuration file. Hugo will, by default, look for a `babel.config.js` file in the root of your project. See [details](https://babeljs.io/docs/en/configuration).
-verbose
-: (`bool`) Log everything
+###### minified
-sourceMap
-: (`string`) Output `inline` or `external` sourcemap from the babel compile. External sourcemaps will be written to the target with the output file name + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps.
+(`bool`) Whether to minify the compiled code. Enables the `compact` option. Default is `false`.
+
+###### noBabelrc
+
+(`string`) Whether to ignore `.babelrc` and `.babelignore` files. Default is `false`.
+
+###### noComments
+
+(`bool`) Whether to remove comments. Default is `false`.
+
+###### sourceMap
+
+(`string`) Whether to generate source maps, one of `external`, `inline`, or `none`. Default is `none`.
+
+
+
+###### verbose
+
+(`bool`) Whether to enable verbose logging. Default is `fasle`