# ssi-loader

> Webpack SSI loader

Latest version **0.0.6** (published 2018-06-14) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install ssi-loader
pnpm add ssi-loader
yarn add ssi-loader
bun add ssi-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2018-06-14 |
| First published | 2018-04-17 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Author | jogiter |
| Maintainers | jogiter |
| Keywords | ssi, webpack |

## Links

- npm: https://www.npmjs.com/package/ssi-loader
- npm.io page: https://npm.io/package/ssi-loader

## Dependencies (4)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [path](https://npm.io/package/path.md) ^0.12.7
- [request](https://npm.io/package/request.md) ^2.85.0
- [loader-utils](https://npm.io/package/loader-utils.md) ^1.1.0

## Alternatives

- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2018-06-14
- 0.0.5 — 2018-06-14
- 0.0.4 — 2018-06-06
- 0.0.3 — 2018-06-06
- 0.0.2 — 2018-04-17

## README

# ssi-loader

Webpack SSI loader

This is a very simple implementation of SSI to be used with as a webpack loader
in development mode.

## Support

Currently only  **include** directives are supported:

```
<!-- absolute path (webpack-config location.include is needed) -->
<!--# include virtual="/includes/new/pre/async" -->

<!-- relative path -->
<!--# include virtual="./includes/new/pre/async" -->

<!-- relative path  ('@'' means root of the project)  -->
<!--# include virtual="@/includes/new/pre/async" -->
```

## Config

Inside your **webpack.dev.config.js** file just add the reference to ssi-loader:

```js
// webpack.dev.config.js

module: {
  rules: [{
    test: /\.html?$/,
    use: [
      {
        loader: 'html-loader' // Used to output as html
      },
      {
        loader: 'ssi-loader',
        options: {
          locations: {
            "include": "https://github.com/Jogiter/ssi-loader",
          }
        }
      }
    ]
  }]
}
```

This will replace all SSI directives with the actual include content.
The ssi-loader only handles the server side includes, in order to return
a valid webpack source you can use the **html-loader** like shown in the
previous example.

## to-think

ssi-loader，会将 ssi 内的内容替换掉页面的注释语法 。而实际上，希望 ssi 更新后可以实时更新，在产品模式不使用ssi-loader，只在在生产模式使用。

>html-webpack-plugin 最新版不支持 3.x webpack

ssi-loader bugs:

- [x] 支持本地 & 远程 ssi
- [x] 开发时，无法监控实时更新（随意修改本地的，会重新拉取远程或者本地的数据）
- [x] 目前仅支持 webpack 3.x，不支持 4.x 

## LICENSE

[WTFPL](http://www.wtfpl.net/)

---
_Source: https://npm.io/package/ssi-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
