Rename Variable

Rename Variable

yarn add @elodin/plugin-rename-variable

The reame variable plugin is used to rename variables.

Usage

To use the plugin, simply add it to your Elodin configuration and you're ready to go.

elodin.config.js

var renameVariable = require('@elodin/plugin-replace-variable')
module.exports = {
plugins: [
renameVariable({
rename: (variable) =>
variable.replace(/_[a-z]/gi, (match) => match.charAt(1).toUpperCase()),
}),
],
}

Configuration

OptionTypeDefaultDescription
renameFunctionA function that given the variable name returns a new one

Example

Given the rename function from the above usage example:

button.elo

(Input)

style Button {
backgroundColor: $theme_primary_color
}

button.elo

(Output)

style Button {
backgroundColor: $themePrimaryColor
}