sardinedev / eleventy-plugins Goto Github PK
View Code? Open in Web Editor NEWA collection of Eleventy Plugins
License: MIT License
A collection of Eleventy Plugins
License: MIT License
Describe the bug
dist
is missing from the NPM package, so we can't use this plugin from eleventy.
To Reproduce
npm install --save-dev @greyskullrocks/eleventy-plugin-tinycss
Then in your eleventy config :
const tinyCSS = require('@greyskullrocks/eleventy-plugin-tinycss');
When running eleventy :
Eleventy fatal error: (more in DEBUG output)
> Error in your Eleventy config file '/PATH/TO/11ty/.eleventy.js'. You may need to run `npm install`.
`EleventyConfigError` was thrown
> Cannot find module '/PATH/TO/11ty/node_modules/@greyskullrocks/eleventy-plugin-tinycss/dist/index.js'. Please verify that the package.json has a valid "main" entry
`Error` was thrown:
Error: Cannot find module '/PATH/TO/11ty/node_modules/@greyskullrocks/eleventy-plugin-tinycss/dist/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:303:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:516:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/PATH/TO/11ty/.eleventy.js:10:17)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
And, indeed, there is no dist
folder.
Initially reported here as NPM is pointing to the wrong repo.
After moving to Parcel we lost the @babel/plugin-transform-modules-commonjs
so we need to do the correct cjs export.
I'm trying to integrate TinyCSS into my project but something goes wrong. CSS is being generated and placed in the html files as it's supposed to.
I've done all the steps: here is my .eleventy.js file:
const strDate = String(Date.now());
const img2picture = require("eleventy-plugin-img2picture");
const tinyCSS = require('@sardine/eleventy-plugin-tinycss');
const eleventyPluginFilesMinifier = require("@sherby/eleventy-plugin-files-minifier");
module.exports = function (eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addShortcode("fileVersion", function () {
return strDate;
});
eleventyConfig.addShortcode("sitemapDate", function () {
return new Date().toISOString().split('T')[0];
});
eleventyConfig.addWatchTarget("./assets/*");
eleventyConfig.addWatchTarget("./assets/*/*");
eleventyConfig.addPassthroughCopy({ "./assets/": "./assets/" });
eleventyConfig.addPassthroughCopy({ "./sitemap.xml": "./sitemap.xml" });
eleventyConfig.addPassthroughCopy({ "./robots.txt": "./robots.txt" });
eleventyConfig.addPassthroughCopy({ "./htaccess.txt": "./htaccess.txt" });
eleventyConfig.addPassthroughCopy({
"./node_modules/tailwindcss/dist/tailwind.min.css": "./assets/css/tailwind.css",
});
eleventyConfig.addPassthroughCopy({
"./node_modules/jquery/dist/jquery.min.js": "./assets/js/jquery.js",
});
eleventyConfig.addPassthroughCopy({
"./node_modules/js-cookie/dist/js.cookie.min.js": "./assets/js/js-cookie.js",
});
eleventyConfig.addPlugin(img2picture, {
eleventyInputDir: ".",
imagesOutputDir: "_site/assets/images/",
urlPath: "/assets/images/",
extensions: ["jpg", "png", "jpeg"],
formats: ["avif", "webp", "jpeg"],
sizes: "100vw",
minWidth: 150,
maxWidth: 1440,
widthStep: 150,
fetchRemote: false,
filenameFormat: function (id, src, width, format) {
const path = require("path");
const extension = path.extname(src);
const name = path.basename(src, extension);
return `${name}-${id}-${width}w.${format}`;
}
});
const tinyOptions = {
autoprefixer: {
add: true,
remove: false,
supports: true
},
};
eleventyConfig.addPlugin(tinyCSS, tinyOptions);
eleventyConfig.addPlugin(eleventyPluginFilesMinifier);
};
But the page that is being rendered fails to apply most, if not all of the CSS so basically nothing works.
I've tried commenting out other plugins such as eleventyPluginFilesMinifier but the result is the same. Only when I comment out this plugin, the page works instantly.
What am I doing wrong? :)
I was trying to use the tiny css plugin but it seems the dist
from the build isn't being published with NPM, causing all eleventy
builds to fail.
Individual READMEs are pointing to old packages
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.