Scripting crazy | Helpfulz

Scripting crazy

July 11, 2019

So I wrote a few scripts later that I thought were super cool and I wanted to write about the experience.

The other day I was writing up some web pages at work and my file structure was getting a bit messy. I was building a landing page and I had several components that where each there own html files and css files. It was getting pretty messy because I’d have individual files for each component and then a separate file for everything all together just to ensure that I wasn’t reusing classes or anything like that. Pretty crazy, so it was getting annoying for me to have to update the component itself and then later update the master file. I’d need to make changes pretty quickly to get going on and so it’d be like update on thing, then make sure I do the file management right, then go back to working on finding the next update. So it was hard to stay focused because finding changes and them making the changes where both two pretty big jobs.

So here’s how I solved this issue for me. I built the things out in their individual component type html files, then I found a way to have a html file pull in html from another html file. So I had one html file that would essentially import all of the other html files along with their css and js files, this way I could have them all together on one page and ensure i’m not messing up the css as well as I would only have to change one file and then it would be totally updated, no need to update two different files every time i make a change.

There was one other script that I wrote that made me smile. The curriculum that we use in the bootcamp has a particular markdown file for every day that gives instructions on what to cover. My friend and I built a tool that goes along with these files to help make keeping track of daily things a bit easier. So I wanted to add a line to each of those files just linking to our project and recommending that people check it out.

So there are three different classes options that could use it, and each class has at least 24 weeks with 3 days each. So there’s a ton of these markdown files and I didn’t want to go into teach of them just to copy one line and save it, that would take forever. So I was able to write a script that went through all the files, found the particular markdown files that I wanted, and then just added my link to the bottom of them. It worked perfectly and I was able to put in a pull request that day, that saved me a bunch of work!

So, just a few experiences that I had with the bash shell that I found really interesting and fun. It’s fun because you can program things right within your computer and the possibilities are pretty endless!

 


Profile picture

Written by IzzleNizzle who can be found playing around in the mountains of Utah. ⛰️ You should follow Iz on Twitter

© 2022, Built with Gatsby and WordPress