Ga naar hoofdinhoud

3 berichten getagd met "javascript"

Laat alle tags zien

· 5 minuten leestijd
Mitchell Mudd

Shopify logo and Rollup logo

Why would you want to use a theme app extension?

The extensions can act like sections in your merchants theme. This gives the merchant the freedom to decide where to put your app extension. A personal benefit that I've experienced from using an extension is the ability to use Tailwindcss instead of the vanilla CSS that Shopify provides.

What are some drawbacks to using a theme app extension?

The way that Shopify expects your code to come in can be quite rigid. You aren't allowed to have any additional folders or files in your app extension. The biggest issue that I ran into was not being able to import files into my main JavaScript file. This is where code splitting using rollup js comes in.

What is code splitting and how can rollup js help?

Code splitting is a technique that allows you to split your code into multiple files. This allows you to import files into your main JavaScript file. This is a great way to organize your code and keep it clean. Rollup js is a module bundler that can help you accomplish this. Rollup is the underlying technology that powers Vite -- an incredibly popular tool for developing front end applications...

· 6 minuten leestijd
Mitchell Mudd

Explore how to handle multipart forms in nodeJS with busboy!

In this post, we'll be exploring how to parse multipart form data in Node.js. We'll be using the busboy module to help us accomplish this! We'll also be using the file system module to save the file to your device.

Getting Started

In an empty folder run the following command to create a package.json file

npm init -y

Then run the following command to initialize a git repository

git init

Create a .gitignore file and add the following line to it. This will tell git to ignore the node_modules folder when we push it to our repository.

node_modules

Finally, run the following command to install the busboy module which we'll be using to parse the form data

npm install busboy

Inside the folder you created, create a file called index.js and one called index.html and open them in your favorite text editor...

· 3 minuten leestijd
Mitchell Mudd

Thumbnail Advent of code is a coding challenge that happens every year in December. This is my first year taking part and I found it a bit clunky to copy and paste the input into a string within my JavaScript file.

The solution: use the Node File System module in synchronous mode 🙂 Using fs.readFileSync may not be best practice on normal project (you’re blocking the program from moving until the file is processed), but for advent of code it’s really nice to simply get your input.