You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now react-snap allows configuration via a reactSnap property in package.json. It's perfectly fine for simple use cases but for more advanced use the full power of JS is desirable. Or perhaps the simplicity of YAML might be appealing to some.
Provide a way to load configuration from various sources. Examples:
package.json property (current)
.reactsnaprc.js
.reactsnap.conf.js
.reactsnaprc.yml
.reactsnaprc (not sure what format it should be, maybe infer from the contents?)
Use case
For my specific use case, I want to use normal JS to I can import some predefined configs. I use UglifyJS in other places in my projects, so I want to import an object with the UglifyJS config and use that for reactSnap.minifyHtml.minifyJS.
Another use case would be to allow using non JSON values. E.g. reactSnap.minifyHtml.minifyJS.mangle.properties.regex and reactSnap.minifyHtml.ignoreCustomComments take a RegExp.
Implementation details
You could roll your own solution like eslint but that seams like overkill.
Nice, cosmiconfig, looks like a winner. Super simple API 👍
Inline JS can already be minified with react-snap. minifyJS is an option for html-minifier, and works great. For example, a working reactSnap config from one of my projects:
Feature request
Feature description
Right now react-snap allows configuration via a
reactSnap
property inpackage.json
. It's perfectly fine for simple use cases but for more advanced use the full power of JS is desirable. Or perhaps the simplicity of YAML might be appealing to some.Provide a way to load configuration from various sources. Examples:
package.json
property (current).reactsnaprc.js
.reactsnap.conf.js
.reactsnaprc.yml
.reactsnaprc
(not sure what format it should be, maybe infer from the contents?)Use case
For my specific use case, I want to use normal JS to I can import some predefined configs. I use UglifyJS in other places in my projects, so I want to import an object with the UglifyJS config and use that for
reactSnap.minifyHtml.minifyJS
.Another use case would be to allow using non JSON values. E.g.
reactSnap.minifyHtml.minifyJS.mangle.properties.regex
andreactSnap.minifyHtml.ignoreCustomComments
take a RegExp.Implementation details
You could roll your own solution like
eslint
but that seams like overkill.It may be better to use an existing package instead.
nconf
andnode-config
look pretty sweet. There're also a bunch of other options listed here.The text was updated successfully, but these errors were encountered: