def _loadFiles(dir_, ext=".js", files=None):
    """Creates a list of files by recursing a file director.
    
    Files returned are filtered by the specified extension 'ext' (optional). The defaul
    extension is '.js'. If 'dir_' is an ordiary file, it will be returned alone in the list.
    """
    if files == None:
        files = []
        
    if dir_.is_dir():
        for f in dir_.iterdir():
            if f.suffix == ext and f.stem != "index":
                files.append(f)
            elif f.is_dir() and not f.name.startswith("_"):
                _loadFiles(f, ext, files)
                
    elif dir_.suffix == ext and dir_.stem != "index":
        files.append(dir_)
        
    return files