Son CV dans un terminal web en Javascript!
https://terminal-cv.gregandev.fr
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.
33 lines
603 B
33 lines
603 B
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = minifyJson;
|
|
|
|
/* Minify JSON inside <script> tags */
|
|
function minifyJson(tree) {
|
|
// Match all <script> tags which have JSON mime type
|
|
tree.match({
|
|
tag: 'script',
|
|
attrs: {
|
|
type: /(\/|\+)json/
|
|
}
|
|
}, node => {
|
|
let content = (node.content || []).join('');
|
|
|
|
if (!content) {
|
|
return node;
|
|
}
|
|
|
|
try {
|
|
content = JSON.stringify(JSON.parse(content));
|
|
} catch (error) {
|
|
return node;
|
|
}
|
|
|
|
node.content = [content];
|
|
return node;
|
|
});
|
|
return tree;
|
|
} |