Site Settings

Use Node Modules in Eleventy

Use Passthrough File Copy to, well, pass them through.

When I started my Eleventy journey, I was still very new to web development. I'd see posts about cool CSS resets or script packages and want to use them, only to be stumped on how to get from npm i to using it in my static site website.

Well, this month I was doing some Googling on something I've already forgotten and found an issue in the 11ty repo where someone asked this exact question, months before I needed it.

The solution? Eleventy's Passthrough File Copy.

// Zach's answer from the GitHub issue
"node_modules/chartist/dist/chartist.min.css": "assets/chartist.min.css",
"node_modules/chartist/dist/chartist.min.js": "assets/chartist.min.js",

If only I knew how to properly Google code questions back then. Hopefully someone else may find this useful.


No mentions yet ¯\_(ツ)_/¯

Keyboard Shortcuts

Secret Konami Code
Secret Green, Red, Green, Yellow, Green, Blue, Green, Orange, Tilt

Bet you weren't expecting these to exist, huh?