Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
// word count
function wordCount(str) {
var text = removeDupicateText(str)
var matches = text.match(/[\u00ff-\uffff]|\S+/g);
return matches ? matches.length : 0;
}
// print all text
console.log('Converted words : ' + removeDupicateText(allText),'(' + wordCount(allText) + ')');
// convert file type
var fontmin = new Fontmin()
.src(fontsSource)
.use(Fontmin.glyph({
text: allText
}))
.use(ttf2woff2({
clone: true
})) // add woff2
.dest(outputPath)
.use(Fontmin.ttf2eot())
.use(Fontmin.ttf2woff({
deflate: true
}))
.use(Fontmin.ttf2svg());
imagemin([outputPath + '*.svg'], outputPath + 'optimize', {
use: [svgo()]
}).then(() => {
console.log('Convert finished'); // Finished
});
// print all text
console.log('Converted words : ' + removeDupicateText(allText),'(' + wordCount(allText) + ')');
// convert file type
var fontmin = new Fontmin()
.src(fontsSource)
.use(Fontmin.glyph({
text: allText
}))
.use(ttf2woff2({
clone: true
})) // add woff2
.dest(outputPath)
.use(Fontmin.ttf2eot())
.use(Fontmin.ttf2woff({
deflate: true
}))
.use(Fontmin.ttf2svg());
imagemin([outputPath + '*.svg'], outputPath + 'optimize', {
use: [svgo()]
}).then(() => {
console.log('Convert finished'); // Finished
});
fontmin.run(function(err, files) {
if (err) {
throw err;
}
});
catch (err) {
return false;
}
};
if (src.length > 1 && !isFile(src[src.length - 1])) {
dest = src[src.length - 1];
src.pop();
}
// start fontmin
new Fontmin()
.src(src)
.use(Fontmin.svgs2ttf(fmOpts.fontFamily, fmOpts))
.use(Fontmin.ttf2eot(fmOpts))
.use(Fontmin.ttf2woff(fmOpts))
.use(Fontmin.ttf2svg(fmOpts))
.use(Fontmin.css(fmOpts))
.use(dump(fmOpts))
.dest(dest || 'output')
.run((err, files, stream) => {
if (err) {
log(err);
process.exit(1);
}
files.forEach(file => {
log(`created: ${file.path}`);
});
log(`\nall ${files.length} files`);
}
// print all text
console.log('Converted words : ' + removeDupicateText(allText),'(' + wordCount(allText) + ')');
// convert file type
var fontmin = new Fontmin()
.src(fontsSource)
.use(Fontmin.glyph({
text: allText
}))
.use(ttf2woff2({
clone: true
})) // add woff2
.dest(outputPath)
.use(Fontmin.ttf2eot())
.use(Fontmin.ttf2woff({
deflate: true
}))
.use(Fontmin.ttf2svg());
imagemin([outputPath + '*.svg'], outputPath + 'optimize', {
use: [svgo()]
}).then(() => {
console.log('Convert finished'); // Finished
});
fontmin.run(function(err, files) {
if (err) {
throw err;
}
});
}
catch (err) {
return false;
}
};
if (src.length > 1 && !isFile(src[src.length - 1])) {
dest = src[src.length - 1];
src.pop();
}
// start fontmin
new Fontmin()
.src(src)
.use(Fontmin.svgs2ttf(fmOpts.fontFamily, fmOpts))
.use(Fontmin.ttf2eot(fmOpts))
.use(Fontmin.ttf2woff(fmOpts))
.use(Fontmin.ttf2svg(fmOpts))
.use(Fontmin.css(fmOpts))
.use(dump(fmOpts))
.dest(dest || 'output')
.run((err, files, stream) => {
if (err) {
log(err);
process.exit(1);
}
files.forEach(file => {
log(`created: ${file.path}`);
});
return false;
}
};
if (src.length > 1 && !isFile(src[src.length - 1])) {
dest = src[src.length - 1];
src.pop();
}
// start fontmin
new Fontmin()
.src(src)
.use(Fontmin.svgs2ttf(fmOpts.fontFamily, fmOpts))
.use(Fontmin.ttf2eot(fmOpts))
.use(Fontmin.ttf2woff(fmOpts))
.use(Fontmin.ttf2svg(fmOpts))
.use(Fontmin.css(fmOpts))
.use(dump(fmOpts))
.dest(dest || 'output')
.run((err, files, stream) => {
if (err) {
log(err);
process.exit(1);
}
files.forEach(file => {
log(`created: ${file.path}`);
});
log(`\nall ${files.length} files`);
// convert file type
var fontmin = new Fontmin()
.src(fontsSource)
.use(Fontmin.glyph({
text: allText
}))
.use(ttf2woff2({
clone: true
})) // add woff2
.dest(outputPath)
.use(Fontmin.ttf2eot())
.use(Fontmin.ttf2woff({
deflate: true
}))
.use(Fontmin.ttf2svg());
imagemin([outputPath + '*.svg'], outputPath + 'optimize', {
use: [svgo()]
}).then(() => {
console.log('Convert finished'); // Finished
});
fontmin.run(function(err, files) {
if (err) {
throw err;
}
});
}
};
if (src.length > 1 && !isFile(src[src.length - 1])) {
dest = src[src.length - 1];
src.pop();
}
// start fontmin
new Fontmin()
.src(src)
.use(Fontmin.svgs2ttf(fmOpts.fontFamily, fmOpts))
.use(Fontmin.ttf2eot(fmOpts))
.use(Fontmin.ttf2woff(fmOpts))
.use(Fontmin.ttf2svg(fmOpts))
.use(Fontmin.css(fmOpts))
.use(dump(fmOpts))
.dest(dest || 'output')
.run((err, files, stream) => {
if (err) {
log(err);
process.exit(1);
}
files.forEach(file => {
log(`created: ${file.path}`);
});
log(`\nall ${files.length} files`);
});
try {
return fs.statSync(path).isFile();
}
catch (err) {
return false;
}
};
if (src.length > 1 && !isFile(src[src.length - 1])) {
dest = src[src.length - 1];
src.pop();
}
// start fontmin
new Fontmin()
.src(src)
.use(Fontmin.svgs2ttf(fmOpts.fontFamily, fmOpts))
.use(Fontmin.ttf2eot(fmOpts))
.use(Fontmin.ttf2woff(fmOpts))
.use(Fontmin.ttf2svg(fmOpts))
.use(Fontmin.css(fmOpts))
.use(dump(fmOpts))
.dest(dest || 'output')
.run((err, files, stream) => {
if (err) {
log(err);
process.exit(1);
}
files.forEach(file => {
return fs.statSync(path).isFile();
}
catch (err) {
return false;
}
};
if (src.length > 1 && !isFile(src[src.length - 1])) {
dest = src[src.length - 1];
src.pop();
}
// start fontmin
new Fontmin()
.src(src)
.use(Fontmin.svgs2ttf(fmOpts.fontFamily, fmOpts))
.use(Fontmin.ttf2eot(fmOpts))
.use(Fontmin.ttf2woff(fmOpts))
.use(Fontmin.ttf2svg(fmOpts))
.use(Fontmin.css(fmOpts))
.use(dump(fmOpts))
.dest(dest || 'output')
.run((err, files, stream) => {
if (err) {
log(err);
process.exit(1);
}
files.forEach(file => {
log(`created: ${file.path}`);
});