mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 10:44:59 +00:00
chore: add vant-icons package
This commit is contained in:
21
packages/vant-icons/build/build-encode.js
Normal file
21
packages/vant-icons/build/build-encode.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const config = require('../src/config');
|
||||
|
||||
function template(fontName, ttf) {
|
||||
return `@font-face {
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-family: '${fontName}';
|
||||
src: url('${ttf}') format('truetype');
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
module.exports = function encode(fontName, srcDir) {
|
||||
const ttfBase64 = fs.readFileSync(`../src/${fontName}.ttf`, 'base64');
|
||||
fs.writeFileSync(
|
||||
path.join(srcDir, 'encode.less'),
|
||||
template(config.name, `data:font/ttf;base64,${ttfBase64}`)
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user