Eli Perelman
8 years ago
29 changed files with 2976 additions and 27 deletions
@ -0,0 +1,71 @@ |
|||
# Neutrino Banner Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-banner` is Neutrino middleware for injecting string content into source code files. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-banner` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-banner |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-banner |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-banner` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const banner = require('neutrino-middleware-banner'); |
|||
|
|||
// Use with default options |
|||
neutrino.use(banner); |
|||
|
|||
// Also accepts options for Webpack's BannerPlugin |
|||
// https://webpack.js.org/plugins/banner-plugin/ |
|||
|
|||
// Usage shows the default values of this middleware: |
|||
neutrino.use(banner, { |
|||
banner: `require('source-map-support').install();`, |
|||
raw: true, |
|||
entryOnly: true |
|||
}); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-banner` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `banner`: Injects string content into application source code. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-banner.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-banner.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-banner |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,71 @@ |
|||
# Neutrino Chunk Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-chunk` is Neutrino middleware for optimizing Webpack bundles via `CommonsChunkPlugin`. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-chunk` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-chunk |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-chunk |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-chunk` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const chunk = require('neutrino-middleware-chunk'); |
|||
|
|||
// Use with default options |
|||
neutrino.use(chunk); |
|||
|
|||
// Also accepts options for Webpack's CommonsChunkPlugin |
|||
// https://webpack.js.org/plugins/commons-chunk-plugin/ |
|||
|
|||
// Usage shows the default values of this middleware: |
|||
neutrino.use(chunk, { |
|||
minChunks: Infinity, |
|||
names: ['vendor', 'manifest'] |
|||
}); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-chunk` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `chunk`: Creates a separate file (known as a chunk), consisting of common modules shared between multiple entry |
|||
points. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-chunk.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-chunk.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-chunk |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,67 @@ |
|||
# Neutrino Clean Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-clean` is Neutrino middleware for removing directories before building. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-clean` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-clean |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-clean |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-clean` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const clean = require('neutrino-middleware-clean'); |
|||
|
|||
// Use with default options |
|||
neutrino.use(clean); |
|||
|
|||
// Usage shows the default values of this middleware: |
|||
neutrino.use(clean, { |
|||
paths: [], |
|||
root: neutrino.options.root |
|||
}); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-clean` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `clean`: Removes directories before building. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-clean.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-clean.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-clean |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,69 @@ |
|||
# Neutrino Compile Loader Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-compile-loader` is Neutrino middleware for compiling source code with Babel. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-compile-loader` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-compile-loader |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-compile-loader |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-compile-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const compile = require('neutrino-middleware-compile-loader'); |
|||
|
|||
neutrino.use(compile, { |
|||
include: [], |
|||
exclude: [], |
|||
babel: {} |
|||
}); |
|||
``` |
|||
|
|||
- `include` should be an array of paths to include in the compilation. Maps to Webpack's |
|||
[`Rule.include`](https://webpack.js.org/configuration/module/#rule-include) |
|||
- `babel` is a [Babel configuration object](https://babeljs.io/docs/usage/api/#options), consumed by babel-loader. Use |
|||
this to set properties such as `presets`, `plugins`, and `env`. |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-compile-loader` creates some conventions to make overriding the configuration easier once you are |
|||
ready to make changes. |
|||
|
|||
### Rules |
|||
|
|||
The following is a list of rules and their identifiers which can be overridden: |
|||
|
|||
- `compile`: Compiles JS and JSX files from the `src` directory using Babel. Contains a single loader named `babel`. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-compile-loader.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-compile-loader.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-compile-loader |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,73 @@ |
|||
# Neutrino Copy Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-copy` is Neutrino middleware for copying files during building. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-copy` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-copy |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-copy |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-copy` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const copy = require('neutrino-middleware-copy'); |
|||
|
|||
// Use with default options |
|||
neutrino.use(copy); |
|||
|
|||
// Usage shows the default values of this middleware: |
|||
neutrino.use(copy, { |
|||
patterns: [], |
|||
options: {} |
|||
}); |
|||
``` |
|||
|
|||
The `patterns` and `options` are defined from the [CopyWebpackPlugin](https://github.com/kevlened/copy-webpack-plugin). |
|||
See their docs for details on valid values to specify. |
|||
|
|||
- `patterns`: An array of patterns specifying copy operations. |
|||
- `options`: An object specifying copy options. |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-copy` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `copy`: Copy files during building. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-copy.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-copy.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-copy |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,67 @@ |
|||
# Neutrino Environment Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-env` is Neutrino middleware for injecting environment variable definitions into |
|||
source code at `process.env`. Always injects `process.env.NODE_ENV`, unless overridden. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-env` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-env |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-env |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-env` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const env = require('neutrino-middleware-env'); |
|||
|
|||
// Use with default options |
|||
neutrino.use(env); |
|||
|
|||
// Usage with additional environment variables |
|||
neutrino.use(env, ['SECRET_KEY']); |
|||
``` |
|||
|
|||
This middleware optionally accepts an array of environment variables to additionally inject into source code. |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-env` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `env`: Inject environment variables into source code at `process.env`. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-env.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-env.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-env |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,138 @@ |
|||
# Neutrino ESLint Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-eslint` is Neutrino middleware for linting source code using ESLint and eslint-loader. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-eslint` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-eslint |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-eslint |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-eslint` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const eslint = require('neutrino-middleware-eslint'); |
|||
|
|||
// Usage shows default values |
|||
neutrino.use(eslint, { |
|||
test: /\.(js|jsx)$/, |
|||
include: [], /* Should specify either include or exclude */ |
|||
exclude: [], /* Should specify either include or exclude */ |
|||
eslint: { |
|||
failOnError: process.env.NODE_ENV !== 'development', |
|||
emitWarning: process.env.NODE_ENV !== 'development', |
|||
emitError: process.env.NODE_ENV !== 'development', |
|||
cwd: neutrino.options.root, |
|||
useEslintrc: false, |
|||
root: true, |
|||
plugins: ['babel'], |
|||
baseConfig: {}, |
|||
envs: ['es6'], |
|||
parser: 'babel-eslint', |
|||
parserOptions: { |
|||
ecmaVersion: 2017, |
|||
sourceType: 'module', |
|||
ecmaFeatures: { |
|||
objectLiteralDuplicateProperties: false, |
|||
generators: true, |
|||
impliedStrict: true |
|||
} |
|||
}, |
|||
settings: {}, |
|||
globals: ['process'], |
|||
rules: {} |
|||
} |
|||
}); |
|||
``` |
|||
|
|||
- `test`: Test which files should be linted. |
|||
- `include`: An array of paths to include in linting. Maps to Webpack's |
|||
[`Rule.include`](https://webpack.js.org/configuration/module/#rule-include) |
|||
- `exclude`: An array of paths to exclude from linting. Maps to Webpack's |
|||
[`Rule.exclude`](https://webpack.js.org/configuration/module/#rule-exclude) |
|||
- `eslint`: An ESLint CLIEngine configuration object for configuring ESLint. Use this to configure rules, |
|||
plugins, and other [ESLint options](http://eslint.org/docs/user-guide/configuring). |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-eslint` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Rules |
|||
|
|||
The following is a list of rules and their identifiers which can be overridden: |
|||
|
|||
- `lint`: By default, lints JS and JSX files from included directories using ESLint. Contains a single loader named |
|||
`eslint`. |
|||
|
|||
## Information |
|||
|
|||
This middleware will show errors and warnings in the console during development, and will cause a failure when |
|||
creating a build bundle. |
|||
|
|||
--- |
|||
|
|||
If you want your preset or middleware to also extend from another **ESLint configuration or preset** that you have made |
|||
a dependency, you must use `baseConfig.extends` rather than just `extends`. This is a limitation of ESLint, not this |
|||
middleware. |
|||
|
|||
--- |
|||
|
|||
This middleware only configures a target environment for `es6`, leaving other build middleware free to add their own |
|||
target environments. If your middleware puts restrictions on which environments it is capable of running, please |
|||
document that clearly in your middleware. |
|||
|
|||
## eslintrc Config |
|||
|
|||
`neutrino-middleware-eslint` also provides a method for getting the ESLint configuration suitable for use in an eslintrc |
|||
file. Typically this is used for providing hints or fix solutions to the development environment, e.g. IDEs and text |
|||
editors. Doing this requires [creating an instance of the Neutrino API](../../api/README.md) and providing the presets uses. |
|||
If you keep this information in `neutrino.presets` in package.json, this should be relatively straightforward. By |
|||
providing all the presets used to Neutrino, you can ensure all the linting options used across all presets will be |
|||
merged together for your development environment, without the need for copying, duplication, or loss of organization and |
|||
separation. |
|||
|
|||
_Example: Create a .eslintrc.js file in the root of the project._ |
|||
|
|||
```js |
|||
// .eslintrc.js |
|||
const Neutrino = require('neutrino'); |
|||
const pkg = require('./package.json'); |
|||
const api = new Neutrino(); |
|||
|
|||
pkg.neutrino.presets.map(preset => neutrino.use(preset)); |
|||
|
|||
module.exports = api.eslintrc(); |
|||
``` |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-eslint.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-eslint.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-eslint |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,70 @@ |
|||
# Neutrino Font Loader Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-font-loader` is Neutrino middleware for loading and importing font files from modules. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-font-loader` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-font-loader |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-font-loader |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-font-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const fonts = require('neutrino-middleware-font-loader'); |
|||
|
|||
// Use with default options |
|||
neutrino.use(fonts); |
|||
|
|||
// Usage showing default options |
|||
neutrino.use(fonts, { |
|||
limit: '10000' |
|||
}); |
|||
``` |
|||
|
|||
- `limit`: Return a Data URL if the file is smaller than a byte limit. |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-font-loader` creates some conventions to make overriding the configuration easier once you are |
|||
ready to make changes. |
|||
|
|||
### Rules |
|||
|
|||
The following is a list of rules and their identifiers which can be overridden: |
|||
|
|||
- `woff`: Allows importing WOFF font files from modules. Contains a single loader named `url`. |
|||
- `ttf`: Allows importing TTF font files from modules. Contains a single loader named `url`. |
|||
- `eot`: Allows importing EOT font files from modules. Contains a single loader named `file`. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-font-loader.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-font-loader.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-font-loader |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,61 @@ |
|||
# Neutrino Hot Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-hot` is Neutrino middleware for enabled Hot Module Replacement with Webpack's |
|||
`HotModuleReplacementPlugin`. This middleware is usually only added during development. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-hot` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-hot |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-hot |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-hot` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const hot = require('neutrino-middleware-hot'); |
|||
|
|||
neutrino.use(hot); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-hot` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `hot`: Enables hot module replacement. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-hot.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-hot.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-hot |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,60 @@ |
|||
# Neutrino HTML Loader Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-html-loader` is Neutrino middleware for loading and importing HTML files from modules. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-html-loader` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-html-loader |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-html-loader |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-html-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const html = require('neutrino-middleware-html-loader'); |
|||
|
|||
neutrino.use(html); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-html-loader` creates some conventions to make overriding the configuration easier once you are |
|||
ready to make changes. |
|||
|
|||
### Rules |
|||
|
|||
The following is a list of rules and their identifiers which can be overridden: |
|||
|
|||
- `html`: Allows importing HTML files from modules. Contains a single loader named `file`. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-html-loader.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-html-loader.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-html-loader |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,75 @@ |
|||
# Neutrino HTML Template Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-html-template` is Neutrino middleware for automatically creating HTML files for configured |
|||
entry-points. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-html-template` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-html-template |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-html-template |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-html-template` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const template = require('neutrino-middleware-html-template'); |
|||
|
|||
// Usage shows default values |
|||
// Accepts options specified by HtmlWebpackTemplate |
|||
// https://github.com/jaketrent/html-webpack-template |
|||
neutrino.use(template, { |
|||
inject: false, |
|||
appMountId: 'root', |
|||
xhtml: true, |
|||
mobile: true, |
|||
minify: { |
|||
useShortDoctype: true, |
|||
keepClosingSlash: true, |
|||
collapseWhitespace: true, |
|||
preserveLineBreaks: true |
|||
} |
|||
}); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-html-template` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `html`: Automatically generates HTML files for configured entry-points. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-html-template.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-html-template.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-html-template |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,70 @@ |
|||
# Neutrino Image Loader Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-image-loader` is Neutrino middleware for loading and importing image files from modules. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-image-loader` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-image-loader |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-image-loader |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-image-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const images = require('neutrino-middleware-image-loader'); |
|||
|
|||
// Use with default options |
|||
neutrino.use(images); |
|||
|
|||
// Usage showing default options |
|||
neutrino.use(images, { |
|||
limit: 8192 |
|||
}); |
|||
``` |
|||
|
|||
- `limit`: Return a Data URL if the file is smaller than a byte limit. |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-image-loader` creates some conventions to make overriding the configuration easier once you are |
|||
ready to make changes. |
|||
|
|||
### Rules |
|||
|
|||
The following is a list of rules and their identifiers which can be overridden: |
|||
|
|||
- `img`: Allows importing JPEG, PNG, and GIF files from modules. Contains a single loader named `url`. |
|||
- `svg`: Allows importing SVG files from modules. Contains a single loader named `url`. |
|||
- `ico`: Allows importing ICO files from modules. Contains a single loader named `url`. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-image-loader.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-image-loader.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-image-loader |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,75 @@ |
|||
# Neutrino Loader Merge Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-loader-merge` is Neutrino middleware for easily performing a deep merge of options into |
|||
a named rule and named loader in a Neutrino configuration. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-loader-merge` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-loader-merge |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-loader-merge |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-loader-merge` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const loaderMerge = require('neutrino-middleware-loader-merge'); |
|||
|
|||
neutrino.use(loaderMerge('compile', 'babel'), { |
|||
plugins: ['object-rest-spread'] |
|||
}); |
|||
|
|||
// Equivalent to: |
|||
neutrino.config.module |
|||
.rule('compile') |
|||
.use('babel') |
|||
.tap(options => require('deepmerge')(options, { |
|||
plugins: ['object-rest-spread'] |
|||
})); |
|||
``` |
|||
|
|||
This middleware is a factory intended to be invoked with a rule name and a loader name for which to extend the options. |
|||
Upon invoking, it will return a middleware function to be provided to Neutrino's `use()` method. |
|||
|
|||
```js |
|||
const middleware = loaderMerge(ruleName, loaderName); |
|||
|
|||
neutrino.use(middleware, options); |
|||
``` |
|||
|
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-loader-merge` does not create any of its own conventions; it is only middleware |
|||
for extending the options for a rule loader which has create its own conventions. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-loader-merge.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-loader-merge.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-loader-merge |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,62 @@ |
|||
# Neutrino Minify Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-minify` is Neutrino middleware for minifying source code using |
|||
[`BabiliWebpackPlugin`](https://www.npmjs.com/package/babili-webpack-plugin). This middleware is usually only |
|||
added during production builds. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-minify` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-minify |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-minify |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-minify` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const minify = require('neutrino-middleware-minify'); |
|||
|
|||
neutrino.use(minify); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-minify` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `minify`: Minifies source code using `BabiliWebpackPlugin`. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-minify.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-minify.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-minify |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,60 @@ |
|||
# Neutrino Named Modules Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-named-modules` is Neutrino middleware for enabling named modules output via `NamedModulesPlugin`. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-named-modules` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-named-modules |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-named-modules |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-named-modules` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const namedModules = require('neutrino-middleware-named-modules'); |
|||
|
|||
neutrino.use(namedModules); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-named-modules` creates some conventions to make overriding the configuration easier once you are |
|||
ready to make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `named-modules`: Enables named modules for improved debugging and console output. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-named-modules.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-named-modules.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-named-modules |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,60 @@ |
|||
# Neutrino Progress Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-progress` is Neutrino middleware for displaying a progress bar showing the progress of a build. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-progress` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-progress |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-progress |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-progress` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const progress = require('neutrino-middleware-progress'); |
|||
|
|||
neutrino.use(progress); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-progress` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `progress`: Displays a bar showing progression of build. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-progress.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-progress.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-progress |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,69 @@ |
|||
# Neutrino Start Server Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-start-server` is Neutrino middleware for starting a Node.js server for a file upon |
|||
completion of a build. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-start-server` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-start-server |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-start-server |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-start-server` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const server = require('neutrino-middleware-start-server'); |
|||
|
|||
// Use with default options, starting the server |
|||
// for the main entry point, neutrino.options.entry |
|||
neutrino.use(server); |
|||
|
|||
// Usage with custom server file to start |
|||
neutrino.use(server, { name: 'custom.js' }); |
|||
``` |
|||
|
|||
By default this middleware will start a server with the single entry point configured in Neutrino. |
|||
This middleware optionally accepts an object with a `name` property for a path to a module which to start the server. |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-start-server` creates some conventions to make overriding the configuration easier once you are ready to |
|||
make changes. |
|||
|
|||
### Plugins |
|||
|
|||
The following is a list of plugins and their identifiers which can be overridden: |
|||
|
|||
- `start-server`: Start a Node.js for a configured entry point or specified file. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-start-server.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-start-server.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-start-server |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
@ -0,0 +1,61 @@ |
|||
# Neutrino Style Loader Middleware |
|||
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url] |
|||
|
|||
`neutrino-middleware-style-loader` is Neutrino middleware for loading and importing stylesheets from modules. |
|||
|
|||
## Requirements |
|||
|
|||
- Node.js v6.9+ |
|||
- Yarn or npm client |
|||
- Neutrino v5 |
|||
|
|||
## Installation |
|||
|
|||
`neutrino-middleware-style-loader` can be installed via the Yarn or npm clients. |
|||
|
|||
#### Yarn |
|||
|
|||
```bash |
|||
❯ yarn add neutrino-middleware-style-loader |
|||
``` |
|||
|
|||
#### npm |
|||
|
|||
```bash |
|||
❯ npm install --save neutrino-middleware-style-loader |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
`neutrino-middleware-style-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package |
|||
and plug it into Neutrino: |
|||
|
|||
```js |
|||
const styles = require('neutrino-middleware-style-loader'); |
|||
|
|||
neutrino.use(styles); |
|||
``` |
|||
|
|||
## Customization |
|||
|
|||
`neutrino-middleware-style-loader` creates some conventions to make overriding the configuration easier once you are |
|||
ready to make changes. |
|||
|
|||
### Rules |
|||
|
|||
The following is a list of rules and their identifiers which can be overridden: |
|||
|
|||
- `css`: Allows importing CSS stylesheets from modules. Contains two loaders named `style` and `css` which use |
|||
`style-loader` and `css-loader`, respectively. |
|||
|
|||
## Contributing |
|||
|
|||
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo |
|||
containing all resources for developing Neutrino and its core presets. Follow the |
|||
[contributing guide](https://neutrino.js.org/contributing) for details. |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-style-loader.svg |
|||
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-style-loader.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-middleware-style-loader |
|||
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg |
|||
[slack-url]: https://neutrino-slack.herokuapp.com/ |
Loading…
Reference in new issue