Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theme-particlex/hexo-babel
A plugin to compile JS for Hexo, using Babel.
https://github.com/theme-particlex/hexo-babel
babel hexo hexo-plugin renderer
Last synced: 2 days ago
JSON representation
A plugin to compile JS for Hexo, using Babel.
- Host: GitHub
- URL: https://github.com/theme-particlex/hexo-babel
- Owner: theme-particlex
- License: mit
- Created: 2022-12-13T07:20:03.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T06:42:49.000Z (19 days ago)
- Last Synced: 2024-11-08T12:51:07.745Z (8 days ago)
- Topics: babel, hexo, hexo-plugin, renderer
- Language: JavaScript
- Homepage:
- Size: 142 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hexo-Babel
[Hexo-Babel](https://github.com/theme-particlex/hexo-babel) 插件,使用 Babel 编译转换 JS 文件。
# 1. 安装
```bash
pnpm add hexo-babel
```# 2. 配置
```yaml
babel:
options:
exclude:
- "*.min.js"
````options` 详见 [Options · Babel](https://babel.dev/docs/en/options) 和 [@babel/preset-env · Babel](https://babel.dev/docs/en/babel-preset-env#options)。
例如这是一种配置(要先安装 `@babel/preset-env`):
```bash
pnpm add @babel/core @babel/preset-env -D
``````yaml
babel:
options:
presets:
- - "@babel/preset-env"
- targets: last 5 versions, not dead, > 0.3%
sourceType: script
exclude:
- "*.min.js"
```或者不填 `options` 参数,使用 `babel.config.json`。
```json
{
"presets": [["@babel/preset-env", { "targets": "last 5 versions, not dead, > 0.3%" }]],
"sourceType": "script"
}
```