Created
January 12, 2019 18:43
-
-
Save gabsprates/42a1e53ee7ea639c98cb77bce013a526 to your computer and use it in GitHub Desktop.
Loader that minify GraphQL queries and mutations. To be used with graphql-tag/loader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(source) { | |
var minified = source | |
.replace(/(\s)?\{(\s)?/gm, "{") | |
.replace(/\s\s/gm, "") | |
.replace(/(\s)?\}(\s)?/gm, "}"); | |
return minified; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment