OLD | NEW |
(Empty) | |
| 1 var fs = require('fs'); |
| 2 var sizeOf = require('image-size'); |
| 3 |
| 4 class SVGSprite { |
| 5 /** |
| 6 * @param {string} filePath |
| 7 * @param {string} content |
| 8 * @param {number} width |
| 9 * @param {number} height |
| 10 */ |
| 11 constructor(filePath, content, width, height) { |
| 12 this.filePath = filePath; |
| 13 this.content = content; |
| 14 this.width = width; |
| 15 this.height = height; |
| 16 } |
| 17 |
| 18 /** |
| 19 * @param {string} filePath |
| 20 * @return {!SVGSprite} |
| 21 */ |
| 22 static loadFromFile(filePath) { |
| 23 var content = fs.readFileSync(filePath, 'utf-8'); |
| 24 var dimensions = sizeOf(filePath); |
| 25 return new SVGSprite(filePath, content, dimensions.width, dimensions.height)
; |
| 26 } |
| 27 }; |
| 28 |
| 29 module.exports = SVGSprite; |
OLD | NEW |