Created
October 9, 2013 23:36
-
-
Save sciolist/6910443 to your computer and use it in GitHub Desktop.
awful browserify transform to pack in client config.
This file contains 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
function packConfiguration() { | |
var config = require('../../client-config.js'); | |
var clientConfig = 'module.exports=exports=(' + JSON.stringify(config) + ');\n'; | |
var clientTransformFile = require.resolve('../../../../public/media/js/config.js'); | |
return function clientConfigTransform(file) { | |
if(file !== clientTransformFile) return through(); | |
var data = ''; | |
return through( | |
function(inp) { data += inp; }, | |
function() { | |
this.queue(clientConfig + data); | |
this.queue(null); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment