A Webpack loader for replacing src and href of image, script and link tag
varExtractTextPlugin=require('extract-text-webpack-plugin')varpath=require('path')return{loader: {test: test,loader: ExtractTextPlugin.extract({use: {loader: 'jade-url-replace-loader',options: {attrs: ['img:src','script:src','link:href'],getEmitedFilePath: function(url){if(!manifest){// get filename with contenthash from manifest files// manifest file should be generated before handvarassetsRoot=path.join(__dirname,'dist')varm1=require(path.join(assetsRoot+'/manifest-js.json'))varm2=require(path.join(assetsRoot+'/manifest-stylus.json'))varm3=require(path.join(assetsRoot+'/manifest-img.json'))manifest=Object.assign({},m1,m2,m3)console.log('Manifest:',manifest)}varpub='/static/'vark=url.replace(pub,'')returnpub+manifest[k]}}}})},plugins: [newExtractTextPlugin('[name].jade')]}