# webpack-ssi-include-loader

> Webpack SSI Include Loader

Latest version **1.6.1** (published 2021-01-08) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.1 |
| Published | 2021-01-08 |
| First published | 2020-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 337.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | ROBERT Sylvain |
| Maintainers | sylrob |
| Keywords | ssi, webpack |

## Links

- npm: https://www.npmjs.com/package/webpack-ssi-include-loader
- Repository: https://github.com/SylRob/webpack-ssi-include-loader
- Homepage: https://github.com/SylRob/webpack-ssi-include-loader#readme
- Issues: https://github.com/SylRob/webpack-ssi-include-loader/issues
- npm.io page: https://npm.io/package/webpack-ssi-include-loader

## Dependencies (7)

- [jest](https://npm.io/package/jest.md) ^26.5.0
- [chardet](https://npm.io/package/chardet.md) ^1.0.0
- [babel-jest](https://npm.io/package/babel-jest.md) ^26.5.2
- [iconv-lite](https://npm.io/package/iconv-lite.md) ^0.5.1
- [then-request](https://npm.io/package/then-request.md) ^6.0.2
- [html-loader-jest](https://npm.io/package/html-loader-jest.md) ^0.2.1
- [jest-test-performance](https://npm.io/package/jest-test-performance.md) ^1.0.1

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@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

## Recent versions

- 1.6.1 (latest) — 2021-01-08
- 1.6.0 — 2021-01-08
- 1.5.2 — 2020-08-27
- 1.5.1 — 2020-08-21
- 1.5.0 — 2020-08-21
- 1.4.0 — 2020-06-23
- 1.3.0 — 2020-06-10
- 1.2.0 — 2020-06-09
- 1.1.4 — 2020-05-22
- 1.1.3 — 2020-05-22
- 1.1.2 — 2020-05-22
- 1.1.1 — 2020-05-22
- 1.1.0 — 2020-05-22
- 1.0.8 — 2020-04-02
- 1.0.7 — 2020-04-01
- … 2 more at https://npm.io/package/webpack-ssi-include-loader/versions

## README

# Webpack SSI Include Loader

![NPM](https://img.shields.io/npm/l/webpack-ssi-include-loader) ![version](https://img.shields.io/github/v/release/SylRob/webpack-ssi-include-loader) ![GitHub last commit](https://img.shields.io/github/last-commit/SylRob/webpack-ssi-include-loader)

[![NPM](https://nodei.co/npm/webpack-ssi-include-loader.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/webpack-ssi-include-loader)


### Description
this package was created to help dev that have to work on with SSI and webpack.
it will help for setting a dev environment.

scan html content looking for pattern like :
```
<!--#include virtual="/your/path/file.html" -->
<!--#include file"/your/path/file.html" -->
```

if found any :
 - first look if the file can be found on the local machine, following the `localPath`
 - if not, try to find the file online following the `location` http url
 - if not, return an error message

### Usage
```
yarn add webpack-ssi-include-loader
```

```js
module: {
      rules: [
          ....
          {
            test: /\.html?$/,
            use: [
              {
                loader: 'html-loader', // Used to output as html
              },
              {
                loader: 'webpack-ssi-include-loader',
                options: {
                  localPath: path.join(__dirname, '/public'),
                  location: 'https://your.website.com/', // http url where the file can be dl
                },
              },
            ],
          },
          ...
```


### Parameters
| Parameters       | Type          | Default        | Description   |
| ---------------- |:-------------:|:--------------:| :------------ |
| location         | string        |                | http url where the file can be dl ex:'https://mywebsite.com/'  |
| localPath        | string        |                | path where the include files could be found ex: path.join(__dirname, '/public') |
| depthMax         | number        |    4           | how far should the SSI include should look for match within included files |
| disableLocalScan | boolean       |    false       | if you want the script to look only on the `location` url |
| includesMatcher  | regex         | /&lt;!--\s?#\s?include\s+(?:virtual&#124;file)=&quot;([^&quot;]+)&quot;?\s?--&gt;/g | regex of the matching string (don't touch unless you know what you are doing) |
| defaultCharset   | string        |    utf-8       | force the file reader to convert the file content into a specific charset |
| quietError       | boolean       |    false       | if the file cannot be found on local or online replace it with an error message or not |
| onFileMatch      | function      |    null        | callback on each SSI line match with 3 parameters : filePath&#60;string&#62;, fileContent&#60;string&#62;, isLocal&#60;boolean&#62;.<br> If you return a string it will override and replace the content |

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