Making Modernizr friendlier for npm/cli #958
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #695.
I'm requesting a couple of small changes so that Modernizr and grunt-modernizr can better talk to each other. For the sake of clarity, I'll first detail my progress with porting the builder to explain my thought process.
I have a first draft available of a v3-friendly grunt-modernizr here for those that are interested in taking a look.
It makes sense (to me anyway) to import Modernizr as an npm module dependency. Since your build tool is already doing most of the work, I'm focusing on handling file parsing and test detection.
I'm using your metadata generator to retrieve the classes and/or test names I need to begin. I then use that data to dig through the current project and start parsing for matches. Once matched, I write the culled list of tests and options back to your
lib/config-all.json
file, and rungrunt build
to generate a customized build. All this happens behind-the-scenes and is invisible to the developer.This seems to work really well. There are just a couple of integration edits I'd like to make:
devDependencies
to actual dependencies. The reason is becausenpm install
ignoresdevDependencies
when installing, meaning I would not be able to rungrunt build
within this context.grunt build
, I'm currently having to spawn a process to run the build task (I couldn't figure out how to weave the two grunt contexts together). This works, but is obviously not ideal. Has there been a thought to provide a programmatic API? The ideal scenario is to be able to runrequire("modernizr").build()
and not have to worry about grunt context and the like.Thanks, and please let me know your thoughts on this setup.