You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							19 lines
						
					
					
						
							687 B
						
					
					
				
			
		
		
	
	
							19 lines
						
					
					
						
							687 B
						
					
					
				const { generateSpritePlaceholder, stringify } = require('../../lib/utils'); | 
						|
 | 
						|
module.exports = function runtimeGenerator({ symbol, loaderContext }) { | 
						|
  // this will be replaced with real symbol url, e.g. sprite.svg#twitter-usage | 
						|
  const publicPath = loaderContext._compiler.options.output.publicPath; | 
						|
  const spritePlaceholder = generateSpritePlaceholder(symbol.request.file); | 
						|
  const viewBoxParts = symbol.viewBox.split(' '); | 
						|
  const width = parseInt(viewBoxParts[2], 10); | 
						|
  const height = parseInt(viewBoxParts[3], 10); | 
						|
 | 
						|
  const data = { | 
						|
    width, | 
						|
    height, | 
						|
    viewBox: symbol.viewBox, | 
						|
    url: publicPath + spritePlaceholder | 
						|
  }; | 
						|
 | 
						|
  return `export default ${stringify(data)}`; | 
						|
};
 | 
						|
 |