Skip to content

Commit

Permalink
Add support for faucet-pipeline-static
Browse files Browse the repository at this point in the history
  • Loading branch information
moonglum committed Nov 6, 2017
1 parent 1566f93 commit 864084b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
48 changes: 37 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ module.exports = {
sass: {
// configuration for faucet-pipeline-sass
},
static: {
// configuration for faucet-pipeline-static
},
watchDirs: {
// configuration for file watching
}
Expand All @@ -178,19 +181,19 @@ only export a `js` option. The pipelines will only be required if you provided
an option for them. Therefore you would only need to install
`faucet-pipeline-js` in that case.

Each of the configurations (`js`, `sass`) requires a `manifest` configuration.
If you don't need a manifest file, set `manifest` to `false`. Otherwise, you
provide an object with two keys: `file` and `baseURI`. `file` is the path where
your manifest file should be written (relative to the config file). `baseURI`
can be either:
Each of the configurations (`js`, `sass`, `static`) requires a `manifest`
configuration. If you don't need a manifest file, set `manifest` to `false`.
Otherwise, you provide an object with two keys: `file` and `baseURI`. `file` is
the path where your manifest file should be written (relative to the config
file). `baseURI` can be either:

1. If your `baseURI` is a String, the manifest values will be generated
like this: `${baseURI}${target}`
2. If your `baseURI` is a function, it will be the return value of your
function. The function will be provided with two arguments: `target` and
`path.basename(target)`.

For example, it could look like this:
For example, it might look like this:

```js
module.exports = {
Expand All @@ -207,15 +210,15 @@ module.exports = {
### Configuration for `faucet-pipeline-js`

The configuration has to include a `bundles` key with an array. Each entry of
the array if an object with two keys: `entryPoint` is the file that should be
the array is an object with two keys: `entryPoint` is the file that should be
compiled, and `target` is the file that should be created (the path is, of
course, modified a little when you use fingerprinting). It also has a third,
optional key `transpiler`. If you provide it, the pipeline will transpile ES201*
to ES3. You need to provide an object with a `transpiler` key that has an array
with features that you want to transpile as an argument.

If you for example want to transpile from ES2015 to ES3, your configuration
could look like this:
might look like this:

```js
module.exports = {
Expand All @@ -238,7 +241,7 @@ module.exports = {
### Configuration for `faucet-pipeline-sass`

The configuration has to include a `bundles` key with an array. Each entry of
the array if an object with two keys: `entryPoint` is the file that should be
the array is an object with two keys: `entryPoint` is the file that should be
compiled, and `target` is the file that should be created (the path is, of
course, modified a little when you use fingerprinting).

Expand All @@ -252,7 +255,7 @@ There are also two optional configurations:
* `prefixes`: A configuration for the
[autoprefixer](https://github.com/postcss/autoprefixer).

The resulting configuration could look something like this:
The resulting configuration might look something like this:

```js
module.exports = {
Expand Down Expand Up @@ -283,13 +286,36 @@ module.exports = {
};
```

### Configuration for `faucet-pipeline-static`

The configuration has to include a `bundles` key with an array. Each entry of
the array is an object with two keys: `source` is the folder of files that
should be copied, and `target` is where the files are copied to.

The resulting configuration might look something like this:

```js
module.exports = {
static: {
manifest: {
file: "./dist/manifest.json",
baseURI: "/assets"
},
bundles: [{
source: "src",
target: "dist"
}]
}
};
```

### Configuration for file watching

You don't need to configure anything for file watching. If you, however, want to
be gentle your file watching limit and your notebook charge, you might want to
restrict file watching to certain folders. Per default, it watches the entire
folder the config file is in. The configuration expects an array of strings. The
strings are paths relative to your configuration file. It could look like this:
strings are paths relative to your configuration file. It might look like this:

```js
module.exports = {
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ let path = require("path");

const PLUGINS = {
js: "faucet-pipeline-js",
sass: "faucet-pipeline-sass"
sass: "faucet-pipeline-sass",
static: "faucet-pipeline-static"
};

module.exports = (rootDir, config = "faucet.config.js", // eslint-disable-next-line indent
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faucet-pipeline",
"version": "0.12.0",
"version": "0.13.0",
"description": "front-end asset pipeline",
"author": "FND",
"contributors": [
Expand Down

0 comments on commit 864084b

Please sign in to comment.