I updated my build process to save 2gb of space lol
web-dev ~ 2017-09-16So I'm on a roll huh? Avoiding all the important stuff and working on my website too much... Well, when I'm stuck in bed because I hurt it's better than gaming or binge watching. I should finally internalize that. Anyway.
Until now, I had a folder that held the raw content of the website. A folder to hold the output of my testing setup. And another folder for the production output. This is bad. Because I had almost 2gb of raw images. I had all these images copied raw in all three places, plus the 250mb of resized versions. I was using too much space. So I fixed that, somewhat.
In Short
To save space from duplicated images, I created a separate config that only handled the processing of images. This config would always output to my production output folder. Then I created symlinks from the production output to the dev-output folder. I then took out any processing of images from my other configs.
Let me show you.
thumbnail_conf.py
So what's important about the below gist is that:
* I ensure through excludes that Pelican doesn't copy anything over
* I turn off every feature I can by setting *_save_as = False
* I ensure feeds are off
The only things that happen now with this configuration is copy the images folder over and run the thumbnailer plugin.
I imagine there are other ways to take care of this that don't force you to keep updating or copying over the folders. If I were to put my images in a different folder from the other content it might be cleaner. Maybe for another day.
Note that the configuration of the thumbnailer plugin is not above. It still resides in the blog_conf I have. This is because I use the configruations of this plugin to generate some javascript which determines which size image to load for the sidebar. Therefore the blog_conf needs it to function. Remember, most everything is loaded from the root config blog_conf.
blog_conf.py and second_conf.py
I also turned off processing of the images in these configs by adding images to the excludes and removing the thumbnailer plugin from the list of active plugins.
STATIC_EXCLUDES = ['images']
PLUGINS = [
'summary', # specify summary in content
'liquid_tags.img', # allows {% img %} in content
'liquid_tags.youtube', # allows {% youtube %} in content
'liquid_tags.soundcloud', # allows {% soundcloud %} in content
'extract_toc', # can render table of contents from post
'pelican-linkclass', # indicator for links leaving domain
'pelicanfly', # adds font awesome support
'assets', # adds compiler for assets
'gallery', # adds gallery support to content
'archives_per_category' # generates archive page per category
]
dev.sh
Inside my testing script I have made some updates.
I had to do a few things in here.
* Add in another instance of Pelican running the thumbnail_conf
* Ensure the output folder for the thumbnails is in production
* Ensure the symlinks are created
build.sh
The production script was even easier to update. Simply add another instance of Pelican with the right config
I also added a condition on the git commands, if anything is passed in it won't do git stuff, so I Can make sure I like what happened when I'm making changes