1.6.1 • Published 3 years ago

webpack-ssi-include-loader v1.6.1

Weekly downloads
79
License
MIT
Repository
github
Last release
3 years ago

Webpack SSI Include Loader

NPM version GitHub last commit

NPM

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
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

ParametersTypeDefaultDescription
locationstringhttp url where the file can be dl ex:'https://mywebsite.com/'
localPathstringpath where the include files could be found ex: path.join(__dirname, '/public')
depthMaxnumber4how far should the SSI include should look for match within included files
disableLocalScanbooleanfalseif you want the script to look only on the location url
includesMatcherregex/<!--\s?#\s?include\s+(?:virtual|file)="(^"+)"?\s?-->/gregex of the matching string (don't touch unless you know what you are doing)
defaultCharsetstringutf-8force the file reader to convert the file content into a specific charset
quietErrorbooleanfalseif the file cannot be found on local or online replace it with an error message or not
onFileMatchfunctionnullcallback on each SSI line match with 3 parameters : filePath<string>, fileContent<string>, isLocal<boolean>. If you return a string it will override and replace the content
1.6.1

3 years ago

1.6.0

3 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago