|
|
@@ -45,7 +45,9 @@ You can also build a self-contained executable if you like chunky binaries with
|
|
|
A working example of how to configure can be found in `src/defaults.js`, with the processors separated out to
|
|
|
`src/processors.js` for tidiness.
|
|
|
|
|
|
-Your `rhedyn.config.js` should export an object with "tasks" and "opts".
|
|
|
+Your `rhedyn.config.js` should export an object with "tasks" and "opts". These are detailed below.
|
|
|
+
|
|
|
+If you want to extend the default config, it can be imported as `defaultConfig` from this package.
|
|
|
|
|
|
#### opts
|
|
|
|
|
|
@@ -53,6 +55,19 @@ The `opts` object in your config is for anything related to the project as a who
|
|
|
means things like the base output directory, where to find templates for the renderer, etc. It'll be passed to the
|
|
|
processor function as a key on the `meta` object.
|
|
|
|
|
|
+`opts` can also have an `include` property, an object containing task keys (e.g. "styles") and paths to include for
|
|
|
+that task, such as additional styles or templates. The path can be anywhere, not just local to the project - I use it to
|
|
|
+include basic typography styles that I know I'll want in every project, but it could just as easily be used to produce a
|
|
|
+sort-of "theme" that could be shared across multiple projects.
|
|
|
+
|
|
|
+ ```
|
|
|
+ opts: {
|
|
|
+ baseDir: 'dist/',
|
|
|
+ templatesDirs: ['templates/'],
|
|
|
+ defaultTemplate: 'default',
|
|
|
+ include: { styles: ['~/.rhedyn/styles/'] }
|
|
|
+ },
|
|
|
+ ```
|
|
|
|
|
|
#### tasks
|
|
|
|
|
|
@@ -61,7 +76,7 @@ Tasks should be an array of objects that look something like this:
|
|
|
```
|
|
|
{
|
|
|
name: "styles",
|
|
|
- inputDir: "styles/",
|
|
|
+ inputDirs: ["styles/"],
|
|
|
outputDir: "static/styles/",
|
|
|
inputFileExtension: ".scss",
|
|
|
outputFileExtension: ".css",
|
|
|
@@ -70,7 +85,10 @@ Tasks should be an array of objects that look something like this:
|
|
|
```
|
|
|
|
|
|
All properties are mandatory, and simply specify where we're reading the files in from and their extensions then where
|
|
|
-to put them once we've processed them. `processor` is a function that takes a file path as it's first argument, which is
|
|
|
+to put them once we've processed them. `inputDirs` is an array of paths, so you could include multiple paths here if you
|
|
|
+wish (some SCSS from a node module, for example).
|
|
|
+
|
|
|
+`processor` is a function that takes a file path as it's first argument, which is
|
|
|
the file path to process, and `meta` as the second argument. `meta` contains the `opts` object, along with the
|
|
|
already-processed filepaths from other tasks:
|
|
|
|
|
|
@@ -78,8 +96,9 @@ already-processed filepaths from other tasks:
|
|
|
{
|
|
|
opts: {
|
|
|
baseDir: 'dist/',
|
|
|
- templatesDir: 'templates/',
|
|
|
- defaultTemplate: 'default'
|
|
|
+ templateDirs: ['templates/'],
|
|
|
+ defaultTemplate: 'default',
|
|
|
+ include: { styles: ['~/.rhedyn/styles/'] }
|
|
|
},
|
|
|
resources: { styles: [
|
|
|
{ path: 'static/styles/main.css', detail: {} }
|
|
|
@@ -93,4 +112,5 @@ A processor is just a function that takes a filepath and meta, returns an object
|
|
|
optionally `detail`. `detail` can contain any properties you like, and is generally for annotating things like "date" or
|
|
|
"author" that might be extracted from the source file (think frontmatter and the like).
|
|
|
|
|
|
-Some examples can be found in `src/processors.js`.
|
|
|
+Some examples can be found in `src/processors.js`, and you can find some utility functions exported from this package as
|
|
|
+`utils`. The sample processors are also exported from this module, as `processors`.
|