Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML minify #224

Merged
merged 1 commit into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
adamduncan marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -323,7 +323,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 @@ -338,7 +340,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