How many files?

How many files?
0

#1

I’ve started to build multi page sites, and I was wondering, how may css and js files should i have?
In terms of CSS, Shold I bundle it all into one style.css or have one main css file and several specific files?
In terms of js, if I have one module for the index.html and another for docs.html, the console will give me an error. For a timed slideshow, that’s a lot of errors that look vary bad and slow down the site. Help? Thanks in advance.


#2

Hi, b3u.

In a production reality, you can have just two files (one for css and one other for js), it doesn’t seem to be a problem to me. But if you are searching for patterns to organize your code, I have some tips that might be useful to you.

I don’t know how is your knowledge about some advanced subjects on css and js, but you can use tools, such as babel, sass and gulp, whose can help you modularize your code but at the end, they put it together in one single production file.

See:
IIFE js pattern
Gulpjs