-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
N.B.: * `happiness` left heavily outdated * `svgtopng.js`: unmodified sample code from https://github.com/domenic/svg2png/blob/master/README.md Although current `svg2png` already has cli support we still need helper buildscript because buildin cli lacks overwrite option (domenic/svg2png#100) In our current setup `dist\images\toggle.png` has to be overwritten during build process
- Loading branch information
johndoe
committed
Mar 21, 2019
1 parent
f5bfff8
commit d188f62
Showing
2 changed files
with
14 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
var svg2png = require('svg2png'); | ||
var ncp = require('ncp'); | ||
var path = require('path'); | ||
const fs = require("pn/fs"); // https://www.npmjs.com/package/pn | ||
const svg2png = require("svg2png"); | ||
|
||
svg2png(path.resolve('src/images/toggle.svg'), path.resolve('src/images/toggle.png'), 1.0, function (err) { | ||
ncp('src/images/toggle.png', 'dist/images/toggle.png'); | ||
}); | ||
fs.readFile("src/images/toggle.svg") | ||
.then(svg2png) | ||
.then(buffer => fs.writeFile("dist/images/toggle.png", buffer)) | ||
.catch(e => console.error(e)); |
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