Sage Disk Space

So I have several sites running sage and I am starting to see a hit on my disk space with each node_modules folder being about 228mb, is there anything I can do differently to remedy this? I almost never use any different modules than the normal setup.

Well I definitely wouldn’t want the image-min to be dropped ever. I guess I was wondering if there was any way for multiple sage themes to utilize the same set of node_modules rather than install a new set for every single theme? Just trying to come up with some ideas to save on space.

That can be tricky, because then you have to make sure your gulp files for each project are completely in sync, make sure that every dependency and sub dependency is the same.

There’s a reason it’s per project - you’re able to come back to a project in 6 months and run npm install and get the same dependencies from 6 months ago. I’m amazed when I open up an old Roots theme, which used Grunt.js, run npm install and everything continues to work.

If you’re finished up with a project, just delete node_modules. You can always run npm install if you have updates to make on it. Just takes a couple minutes, you can grab a coffee before beginning work on it again :smile:

4 Likes

https://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders

You can just remove gulp-imagemin from the sage requirements and then just npm i -g gulp-imagemin

Actually the idea of just deleting node_modules when done with development is a perfect idea and just reinstall if its ever needed again.

Thanks for the tip.