Configuration
We already learned that Elodin requires a generator and a list of sources to run.
Apart from that, we can pass a bunch of other configurations.
Configuration | Value | Default | Description |
---|---|---|---|
generator | Generator | The target generator that is used to compile all elodin files to a desired target format. | |
sources | Array<Path> | List of source folders which contain elodin files that should be compiled. | |
plugins | Array<Plugin> | [] | List of plugins to be applied before compilation |
errors | ,
| throw | Whether compilation errors throw or just log. It is recommend to throw in order to ensure valid output. |
Example
Note: We're using ES5 here since it won't pre-compile configuration files by default. If you want to write modern ES2015+, you'll have to transpile those with e.g. Babel first.
elodin.config.js
var { createGenerator } = require('@elodin/generator-javascript-css') var replaceVariable = require('@elodin/plugin-replace-variabe') module.exports = { sources: ['src', 'components'], errors: 'log', plugins: [ replaceVariable({ variables: { primaryColor: 'blue', secondaryColor: 'red', baseFontSize: 16, gridStep: 8, }, }), ], generator: createGenerator({ devMode: true, }), }