S1SYPHOS / Gulp-Kirby-Starter-Kit

Getting started with Gulp v4 & Kirby v3 in no-time
MIT License
47 stars 6 forks source link

Export to multiple JS files #6

Closed grommas closed 3 years ago

grommas commented 4 years ago

Hi Martin,

thanks for your boilerplate, you did an awesome job! I have a question though. It’s not an issue, but would it be possible to get multiple folder/files compiled to multiple js files?

For the SCSS stuff it’s as easy as creating new folders for multiple CSS files. I'd like to have the same results for the JS, but I don’t know how to handle that since the input inside the config.js is declared as one file. I stumpled across following instructions, would it be a starting point?

https://macr.ae/article/splitting-gulpfile-multiple-files

I’m definitly not an expert to gulp and webpack and hope not to ask too silly questions..

S1SYPHOS commented 4 years ago

I'll have a look and see what I can do for you!

S1SYPHOS commented 3 years ago

@grommas Hey there, sorry for getting back at you this late (life and all):

Did you want to build multiple JS files or just have multiple JS files build one main JS in the end?

Because webpack can totally do the first for you, and the latter is just a matter of using import statements, really.

However, I've been thinking to implement a way to generate files out-of-the-box to be picked up by Kirby depending on the template being used. But since I myself never needed this (keep your code lean, build one file, load it early on and never look back), I didn't include something like that 😕

grommas commented 3 years ago

Ah, I see. I wanted to have different templates with different webpack builds at the end, just sharing some needed patterns. Probably it’s better to isolate each template with an own starter kit and make plugins out of it afterwards. Thanks for your response!

S1SYPHOS commented 3 years ago

Feedback of any kind is always welcome - thanks for that!