Skip to content

Commit

Permalink
Merge pull request #224 from ceph/feature/220-minify-html
Browse files Browse the repository at this point in the history
HTML minify
  • Loading branch information
Pete-Robelou authored Jun 22, 2021
2 parents 84e60b9 + 4551849 commit ffd9eff
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 6 deletions.
6 changes: 4 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const fs = require('fs');

// Plugins
const eleventyNavigationPlugin = require('@11ty/eleventy-navigation');
const sitemap = require('@quasibit/eleventy-plugin-sitemap');
const build = require('./src/_data/build');
const i18n = require('eleventy-plugin-i18n');
const markdownIt = require('markdown-it');
const markdownItAnchor = require('markdown-it-anchor');
const build = require('./src/_data/build');
const sitemap = require('@quasibit/eleventy-plugin-sitemap');
const translations = require('./src/_data/i18n');

module.exports = function (eleventyConfig) {
Expand Down Expand Up @@ -79,6 +79,8 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addShortcode('YouTube', require(`${shortcodesDir}/YouTube.js`));

// Transforms
const transformsDir = `./src/_11ty/transforms`;
eleventyConfig.addTransform('htmlmin', require(`${transformsDir}/html-minifier.js`));

// Passthrough copy
eleventyConfig.addPassthroughCopy('./src/assets/**/*.json');
Expand Down
70 changes: 68 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"cross-env": "7.0.2",
"cssnano": "^4.1.10",
"eleventy-plugin-i18n": "0.1.0",
"html-minifier": "^4.0.0",
"husky": "^6.0.0",
"imagemin": "^7.0.1",
"imagemin-mozjpeg": "^9.0.0",
Expand Down
14 changes: 14 additions & 0 deletions src/_11ty/transforms/html-minifier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const htmlmin = require('html-minifier');

module.exports = (content, outputPath) => {
if (outputPath && outputPath.endsWith('.html')) {
return htmlmin.minify(content, {
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
});
}

return content;
};
9 changes: 7 additions & 2 deletions src/en/community/team/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ <h3 class="h3" id="sebastien-han">Sebastien Han</h3>
working with containers as well and ultimately implemented containerized Docker Ceph services. Now on a daily basis, he rotates
between Ceph, OpenStack, and Docker in an effort to strengthen the integration between all three. From time to time, he attends
various events where he evangelizes these technologies and their usage, while devoting his copious spare time to blogging. See
<http://www.sebastien-han.fr/blog/>. But alas, this is just the beginning :).
<a class="a" href="http://www.sebastien-han.fr/blog/" rel="noreferrer noopener" target="_blank"
>http://www.sebastien-han.fr/blog/</a
>. But alas, this is just the beginning :).
</p>
</div>
</div>
Expand All @@ -343,7 +345,10 @@ <h3 class="h3" id="chris-jones">Chris Jones</h3>
<p class="mb-0 p">
Chris is a Technical Lead at Bloomberg for Cloud Storage, including Ceph Object and Block storage. He maintains Ceph-Chef Chef
Cookbooks and Ceph-Rust (Official Rust SDK for Ceph). Chris also maintains other opensource projects for Enterprise storage
including aws-sdk-rust and s3lsio located at <https://github.com/lambdastackio>.
including aws-sdk-rust and s3lsio located at
<a class="a" href="https://github.com/lambdastackio" rel="noreferrer noopener" target="_blank"
>https://github.com/lambdastackio</a
>.
</p>
</div>
</div>
Expand Down

0 comments on commit ffd9eff

Please sign in to comment.