diff options
Diffstat (limited to 'docs/content/en/functions/js/Babel.md')
-rw-r--r-- | docs/content/en/functions/js/Babel.md | 71 |
1 files changed, 32 insertions, 39 deletions
diff --git a/docs/content/en/functions/js/Babel.md b/docs/content/en/functions/js/Babel.md index 08bce47e5..d0007aaa0 100644 --- a/docs/content/en/functions/js/Babel.md +++ b/docs/content/en/functions/js/Babel.md @@ -3,17 +3,11 @@ title: js.Babel description: Compile the given JavaScript resource with Babel. categories: [] keywords: [] -action: - 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 +params: + functions_and_methods: + aliases: [babel] + returnType: resource.Resource + signatures: ['js.Babel [OPTIONS] RESOURCE'] --- ```go-html-template @@ -37,18 +31,21 @@ toc: true ## Setup -Step 1 -: Install [Node.js](https://nodejs.org/en/download) +### Step 1 -Step 2 -: Install the required Node.js packages in the root of your project. +Install [Node.js](https://nodejs.org/en/download) + +### Step 2 + +Install the required Node.js packages in the root of your project. ```sh npm install --save-dev @babel/core @babel/cli ``` -Step 3 -: Add the babel executable to Hugo's `security.exec.allow` list in your site configuration: +### Step 3 + +Add the babel executable to Hugo's `security.exec.allow` list in your site configuration: {{< code-toggle file=hugo >}} [security.exec] @@ -75,32 +72,28 @@ module.exports = { ## Options -###### compact - -(`bool`) Whether to remove optional newlines and whitespace. Enabled when `minified` is `true`. Default is `false` - -###### config - -(`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). - -###### minified - -(`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`. +compact +: (`bool`) Whether to remove optional newlines and whitespace. Enabled when `minified` is `true`. Default is `false` -###### noComments +config +: (`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). -(`bool`) Whether to remove comments. Default is `false`. +minified +: (`bool`) Whether to minify the compiled code. Enables the `compact` option. Default is `false`. -###### sourceMap +noBabelrc +: (`string`) Whether to ignore `.babelrc` and `.babelignore` files. Default is `false`. -(`string`) Whether to generate source maps, one of `external`, `inline`, or `none`. Default is `none`. +noComments +: (`bool`) Whether to remove comments. Default is `false`. -<!-- In the above, technically "none" is not one of the enumerated values, but it has the same effect and is easier to document than an empty string. --> +sourceMap +: (`string`) Whether to generate source maps, one of `external`, `inline`, or `none`. Default is `none`. -###### verbose +verbose +: (`bool`) Whether to enable verbose logging. Default is `false` -(`bool`) Whether to enable verbose logging. Default is `false` +<!-- +In the above, technically "none" is not one of the enumerated sourceMap +values but it has the same effect and is easier to document than an empty string. +--> |