# makestatic-sources-loader

> Loads source files from disc

Latest version **1.0.24** (published 2018-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install makestatic-sources-loader
pnpm add makestatic-sources-loader
yarn add makestatic-sources-loader
bun add makestatic-sources-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.0.24 |
| Published | 2018-01-18 |
| First published | 2017-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node |  >= 6.1.x |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | muji |
| Maintainers | muji, tmpfs |
| Keywords | makestatic, makestatic-plugin, sources, file, loader |

## Links

- npm: https://www.npmjs.com/package/makestatic-sources-loader
- Repository: https://github.com/makestatic/compiler
- Homepage: https://makestatic.ws
- Issues: https://github.com/makestatic/compiler/issues
- npm.io page: https://npm.io/package/makestatic-sources-loader

## Dependencies (2)

- [when](https://npm.io/package/when.md) ^3.7.7
- [globule](https://npm.io/package/globule.md) ^1.1.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.24 (latest) — 2018-01-18
- 1.0.23 — 2018-01-17
- 1.0.22 — 2017-03-08
- 1.0.21 — 2017-03-08
- 1.0.20 — 2017-03-07
- 1.0.19 — 2017-03-04
- 1.0.18 — 2017-02-28
- 1.0.17 — 2017-02-25
- 1.0.16 — 2017-02-21
- 1.0.15 — 2017-02-21
- 1.0.14 — 2017-02-15
- 1.0.13 — 2017-02-14
- 1.0.12 — 2017-02-12
- 1.0.11 — 2017-02-11
- 1.0.10 — 2017-02-10
- … 10 more at https://npm.io/package/makestatic-sources-loader/versions

## README

# Sources Loader

> Load file sources into the pipeline

Adds input files to the pipeline.

---

- [Install](#install)
- [API](#api)
  - [SourcesLoader](#sourcesloader)
    - [.before](#before)
    - [.sources](#sources)
      - [Options](#options)
      - [Throws](#throws)
- [License](#license)

---

## Install

```
yarn add makestatic-sources-loader
```

## API

### SourcesLoader

Initializes the source files that will be processed.

#### .before

```javascript
SourcesLoader.prototype.before(context)
```

Propagates the list of files to process.

If the configuration option `files` is an array it is used otherwise all
files in the `input` directory are added to the list of files to process.

* `context` Object the processing context.

#### .sources

```javascript
SourcesLoader.prototype.sources(file, context[, options])
```

Reads a file from disc.

If the file name matches a pattern in the `matchers` configuration option
if is assigned the corresponding file extension so that it will be
renamed when the file output path is set.

If the file name matches a pattern in the `ignore` configuration option
it is removed from the list of files to process.

If the file points to a directory it is removed from the list of files to
process.

By default this implementation will read the file content and assign the
buffer to the `file.buffer` and set the initial `file.content` unless the
`buffer` option is disabled.

If the `buffer` option is disabled the file will still be assigned
a `stat` object.

Returns a promise that resolves when the file has been read.

* `file` Object the current file.
* `context` Object the processing context.
* `options` Object plugin options.

##### Options

* `load` Boolean=true the file buffer.

##### Throws

* `Error` if the stat fails.
* `Error` if the file read fails.

## License

MIT

---

Created by [mkdoc](https://github.com/mkdoc/mkdoc) on March 12, 2017

[docs]: https://makestatic.ws/docs/ "Documentation"
[standalone manual]: https://github.com/makestatic/website/blob/master/MANUAL.md "Standalone Manual"
[yarn]: https://yarnpkg.com "Yarn"
[webpack]: https://webpack.js.org "Webpack"
[babel]: https://babeljs.io "Babel"
[postcss]: http://postcss.org "Postcss"
[sugarss]: https://github.com/postcss/sugarss "Sugarss"
[reshape]: https://github.com/reshape/reshape "Reshape Source Code"
[reshapeml]: https://reshape.ml "Reshape"
[clean-css]: https://github.com/jakubpawlowicz/clean-css "Clean CSS"
[html-minifier]: https://github.com/kangax/html-minifier "Html Minifier"
[uglify-js]: https://github.com/mishoo/UglifyJS2 "Uglify JS"
[imagemin]: https://github.com/imagemin/imagemin "Imagemin"
[mkdoc]: https://github.com/mkdoc/mkdoc "Mkdoc"
[browsersync]: https://www.browsersync.io "Browsersync"
[yeoman]: http://yeoman.io "Yeoman"
[spike]: https://www.spike.cf "Spike"
[validator]: https://github.com/validator/validator "HTML Validator"
[github pages]: https://pages.github.com "Github Pages"
[amazon s3]: https://aws.amazon.com/s3/ "Amazon S3"
[google sitemaps]: https://support.google.com/webmasters/answer/183668?hl=en&ref_topic=4581190 "Google Sitemaps"
[sitemaps]: https://www.sitemaps.org/ "Sitemaps"

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