RSSAmplifier

Troy Vassalotti :: Blog · Apr 1, 2022

Use Node Modules in Eleventy

0
Sign in to vote or save

www.troyv.dev

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
				eleventyConfig.addPassthroughCopy({
					"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.

Read the original on troyv.dev

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.