iOS, macOS, firefox css tweaks; config and readme updates;

This commit is contained in:
Spencer Flagg
2022-10-24 14:17:02 +02:00
parent 9ca6779388
commit 5c12e2aaea
24 changed files with 227 additions and 121 deletions

View File

@@ -1,9 +1,11 @@
const eleventySass = require("eleventy-sass");
const lazyImagesPlugin = require('eleventy-plugin-lazyimages');
const faviconPlugin = require("eleventy-favicon");
// https://github.com/artstorm/eleventy-plugin-seo
const pluginSEO = require("eleventy-plugin-seo");
// https://www.npmjs.com/package/eleventy-plugin-img2picture
// https://github.com/saneef/eleventy-plugin-img2picture
const img2picture = require("eleventy-plugin-img2picture");
// https://www.npmjs.com/package/@sardine/eleventy-plugin-tinycss
@@ -17,13 +19,15 @@ const tinyHTML = require('@sardine/eleventy-plugin-tinyhtml');
module.exports = function (eleventyConfig) {
// passthrus
//eleventyConfig.addPassthroughCopy("./src/assets/styles");
eleventyConfig.addPassthroughCopy('src/assets/fonts');
eleventyConfig.addPassthroughCopy("./src/assets/js");
if (process.env.ELEVENTY_ENV === "production") {
if (process.env.ELEVENTY_ENV === "enable-image-optim") {
// img2picture (recommend not enabling)
////// this plugin smartly optimizes images on build, such as converting pngs to smaller jpegs.
////// did not see noticable speed gains when enabled, but it did cause rendering issues on older versions of Safari (e.g. on Calalina).
////// specifially, jpeg masking (as a replacement for alpha pngs) doesn't seem to work for all browsers.
eleventyConfig.addPlugin(img2picture, {
// Should be same as Eleventy input folder set using `dir.input`.
eleventyInputDir: "src",
@@ -35,6 +39,8 @@ module.exports = function (eleventyConfig) {
// It should match with path suffix in `imagesOutputDir`.
// Eg: imagesOutputDir with `_site/images` likely need urlPath as `/images/`
urlPath: "/assets/images/",
sharpPngOptions: { pallette: true },
sharpJpegOptions: { quality: 100 }
});
} else {
// During development, copy the files to Eleventy's `dir.output`
@@ -45,38 +51,13 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(eleventySass);
eleventyConfig.addPlugin(faviconPlugin, { destination: './_site' });
eleventyConfig.addPlugin(pluginSEO, require("./src/_data/seo.json"));
//eleventyConfig.addPlugin(tinyCSS);
//eleventyConfig.addPlugin(tinyCSS); // smartly injects selectors from external css files into style tags. requires some massaging. not ready for prime time.
eleventyConfig.addPlugin(tinyHTML);
eleventyConfig.addPlugin(tinysvg, {
baseUrl: 'src/_includes/svgs/',
});
// eleventyConfig.addPlugin(lazyImagesPlugin, {
// imgSelector: 'img:not(.unlazy)', // custom image selector
// //cacheFile: '', // don't cache results to a file
// });
return {
dir: { input: "src", output: "_site", data: "_data" },
};
};
// module.exports = function (eleventyConfig) {
// if (process.env.ELEVENTY_ENV === "production") {
// eleventyConfig.addPlugin(img2picture, {
// // Should be same as Eleventy input folder set using `dir.input`.
// eleventyInputDir: ".",
// // Output folder for optimized images.
// imagesOutputDir: "_site",
// // URL prefix for images src URLS.
// // It should match with path suffix in `imagesOutputDir`.
// // Eg: imagesOutputDir with `_site/images` likely need urlPath as `/images/`
// urlPath: "",
// });
// } else {
// // During development, copy the files to Eleventy's `dir.output`
// eleventyConfig.addPassthroughCopy("./images");
// }
// };
};