Rory's Blog
Home
Blog
Projects
Facebook
Google+
Github
RSS

JavaScript: Time to Modularize

10/14/15

All right, first time writing a post in my views area.

It's kinda a little weird. Like, there's not all this filler content filling up my screen with excess color. There's a lot more black background than I'm used to.

My publishing scripts haven't quite caught up to my new area, though, so I'll be pulling some hackery here and there still.

Which really is related to the main topic of today's post: modularizing.

I have all this useful code across various javascript files, and no way to use them between the files because I didn't actually write the files as require-able node modules. They all expect to be run as main.

That means I need to publish.js a new post before I indexGenerate.js. Well, it used to mean that. Now, I need to move my file into the proper views/blog area, htmlGenerate.js it, publish.js the generated public/blog file, and then indexGenerate.js.

This should be one command, but the code should still be across the various files. And there's no reason not to make it possible to be one node command (and not, say, a bash script that calls all these things in sequence).

This is my goal for right now. It'll probably mean rewriting a lot of my current files, which is good, I'm quite enjoying redoing functionality from scratch lately. It's also great for javascript mastery.

Long-term, this will also be good, as I'll be developing a proper javascript library for my site. Again, I plan to abandon it when the year ends, but all the more reason to go crazy now, so I can learn what I need to learn before I have another go at it.

In any case, blog-scripting is finally happening again, and happening in full-force, and I'm excited to see what comes of it.