Allow specifying extensions
Closed this issue · 1 comments
Right now envify processes files of all extensions, except for .json
.
I'm in a situation where I'm requiring files of different extensions (.html
to load template strings, .tag
for RiotJS tag files), and I need envify to apply only to .js
, and ignore those files.
I think this could be added in a pretty-backwards-compatible way:
If the env
property is not an object, the current behavior is assumed:
envify({
_: 'purge',
BUTTS: 'YES',
env: 'PRODUCTION'
})
If the env
property is an object, its properties are used as the environment variables, and the rest of the top-level object is used for options like purge
and extensions
:
envify({
purge: true,
extensions: ['.js', '.mjs'],
env: {
BUTTS: 'YES',
env: 'PRODUCTION'
}
})
What do you think? Would you take a pull request implementing this change? Would you prefer a different implementation, or would you rather not support different extensions?
Hey there, thanks for opening this issue!
would you rather not support different extensions
I know Hugh's stance is to not extend the scope of this package further, and I'm pretty "meh" about applying certain variables only to certain files: so no thank you!