Configuration

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.

ConfigurationValueDefaultDescription
generatorGeneratorThe target generator that is used to compile all elodin files to a desired target format.
sourcesArray<Path>List of source folders which contain elodin files that should be compiled.
pluginsArray<Plugin>[]List of plugins to be applied before compilation
errors
throw
,
log
throwWhether 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,
}),
}