madrilene / eleventy-excellent

Eleventy starter based on the workflow suggested by Andy Bell's buildexcellentwebsit.es.
https://eleventy-excellent.netlify.app/
Other
394 stars 70 forks source link

On the issue of dependencies vs devDependencies #8

Closed souserge closed 1 year ago

souserge commented 1 year ago

Hi, thanks for the amazing Eleventy template!

I've been scanning Eleventy projects and I noticed that many put all of the packages in devDependencies. This project keeps some in dependencies. I wonder if there is any reason to put a particular package into one or the other place. To me, the devDependencies should contain packages used only by developers on their local machines, e.g. dotenv or linting/code formatting packages, testing utils etc. Yet, I see many tutorials and eleventy packages that add everything into devDependencies, thus making it impossible not to install dev tools in production i.e. on build. Am I missing something here?

madrilene commented 1 year ago

That's something I've never fully figured out... But I think in the case of Eleventy (or rather, in the case of this template) everything can really live in devDependencies.

What you can do by using both is trying to improve the readability, and that was actually my original idea behind that. I wanted to put everything that belongs to Eleventy and Tailwind in dependencies, so that you can see right away that these two elements are involved here - although Tailwind doesn't really have a main role. In the end, I mixed it all up a bit.

Generally, the following applies: dependencies: Packages that are needed by the application in production. devDependencies: packages that are only needed for local development and testing.

So, if you want, you can just uninstall the packages and then reinstall them with the -D flag.