Skip to content
Snippets Groups Projects
Verified Commit 980aceb6 authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

Do not minify images in debug mode

parent feb20f9a
Branches
No related tags found
No related merge requests found
......@@ -82,11 +82,16 @@ module.exports = function() {
var tr = this;
tr.fancyname = "transformer images";
tr.pre = function(cb, list) {
minify()
.then(function(imageList) {
list.images = imageList;
if(process.argv[2] == "compileonly") {
minify()
.then(function(imageList) {
list.images = imageList;
cb();
})
.catch(function(err) {console.log(err.stack); cb();});
} else {
console.log("Skipping image minification");
cb();
})
.catch(function(err) {console.log(err.stack); cb();});
}
}
}
......@@ -8,6 +8,7 @@ try {require('lwip');}
catch(e) {
minificationOK = false;
}
if(process.argv[2] !== "compileonly") minificationOK = false;
var images = {};
......@@ -44,10 +45,11 @@ module.exports = function() {
var tr = this;
tr.fancyname = "transformer markdown";
tr.pre = function(cb, list) {
list.images.forEach((img) => {
images[img.file] = img;
});
console.log(images);
if(minificationOK) {
list.images.forEach((img) => {
images[img.file] = img;
});
}
cb();
};
tr.forEachPage = function(article, cb) {
......@@ -84,13 +86,13 @@ module.exports = function() {
if(size.length > 1 && size[1].length > 0) {
out += ' height="' + size[1] + '"';
}
} else if(!minificationOK) {
out += ' style="max-width:512px"';
}
if (title) {
out += ' title="' + title + '"';
}
if(!minificationOK) {
out += ' style="max-width:512px"';
}
out += '>';
if(full) {
var a = '<a href="'+full+'"';
......
......@@ -258,7 +258,7 @@ nav.subnav li {
text-align: left;
padding: 0 .5rem;
max-width: $p-max-width;
margin: 10px auto;
margin: 0px auto;
}
h3, h4, h5, h6 {
max-width: $p-max-width;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment