Giter VIP home page Giter VIP logo

eleventy-plugins's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar marabyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

lukaszklis

eleventy-plugins's Issues

Missing `dist`

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.

Update plugin exports

After moving to Parcel we lost the @babel/plugin-transform-modules-commonjs so we need to do the correct cjs export.

TinyCSS breaks CSS and page fails to render properly.

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? :)

Publish Dist

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.