开源项目 `script-ext-html-webpack-plugin` 使用教程

开源项目 script-ext-html-webpack-plugin 使用教程

script-ext-html-webpack-pluginEnhances html-webpack-plugin functionality with different deployment options for your scripts including 'async', 'preload', 'prefetch', 'defer', 'module', custom attributes, and inlining.项目地址:https://gitcode.com/gh_mirrors/sc/script-ext-html-webpack-plugin

1. 项目的目录结构及介绍

script-ext-html-webpack-plugin/
├── LICENSE
├── README.md
├── lib
│   ├── index.js
│   └── options.js
├── package.json
└── test
    ├── index.js
    └── test-cases
        ├── async-scripts
        │   ├── index.js
        │   └── template.html
        ├── defer-async-scripts
        │   ├── index.js
        │   └── template.html
        ├── defer-scripts
        │   ├── index.js
        │   └── template.html
        ├── inline-async-scripts
        │   ├── index.js
        │   └── template.html
        ├── inline-defer-scripts
        │   ├── index.js
        │   └── template.html
        ├── inline-scripts
        │   ├── index.js
        │   └── template.html
        ├── no-scripts
        │   ├── index.js
        │   └── template.html
        ├── preload-scripts
        │   ├── index.js
        │   └── template.html
        └── sync-scripts
            ├── index.js
            └── template.html

目录结构介绍

  • LICENSE: 项目许可证文件。
  • README.md: 项目说明文档。
  • lib: 包含项目的主要代码文件。
    • index.js: 插件的主入口文件。
    • options.js: 插件的配置选项处理文件。
  • package.json: 项目的依赖管理文件。
  • test: 包含项目的测试文件。
    • index.js: 测试的主入口文件。
    • test-cases: 包含各种测试用例。
      • async-scripts, defer-async-scripts, defer-scripts, inline-async-scripts, inline-defer-scripts, inline-scripts, no-scripts, preload-scripts, sync-scripts: 不同场景的测试用例。
      • index.js: 每个测试用例的入口文件。
      • template.html: 每个测试用例的模板文件。

2. 项目的启动文件介绍

项目的启动文件位于 lib/index.js。这个文件是插件的主入口,负责初始化和应用插件的主要逻辑。

主要功能

  • 初始化插件实例。
  • 处理配置选项。
  • 在 Webpack 构建过程中注入脚本标签。

3. 项目的配置文件介绍

项目的配置文件主要是 package.jsonlib/options.js

package.json

package.json 文件包含了项目的元数据和依赖信息。

{
  "name": "script-ext-html-webpack-plugin",
  "version": "2.1.5",
  "description": "Enhances html-webpack-plugin functionality with async, defer, type='module', preload, prefetch and custom attributes for your script tags.",
  "main": "lib/index.js",
  "scripts": {
    "test": "mocha --recursive"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/numical/script-ext-html-webpack-plugin.git"
  },
  "keywords": [
    "webpack",
    "plugin",
    "html-webpack-plugin",
    "async",
    "defer",
    "module",
    "preload",
    "prefetch"
  ],
  "author": "Mike Evans <mike.evans@numical.com>",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/numical/script-ext-html-webpack-plugin/issues"
  },
  "homepage": "https://github.com/numical/script-ext-html-webpack-plugin#readme",
  "dependencies": {
    "html-webpack-plugin": "^4.0.0-beta.5",
    "lodash.merge": "^4.6.2"
  },
  "devDependencies": {
    "chai": "^4.2.0",
    "mocha": "^6.1.4",
   

script-ext-html-webpack-pluginEnhances html-webpack-plugin functionality with different deployment options for your scripts including 'async', 'preload', 'prefetch', 'defer', 'module', custom attributes, and inlining.项目地址:https://gitcode.com/gh_mirrors/sc/script-ext-html-webpack-plugin

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

沈昂钧

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值