Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Folder vs. file name

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34430
    aoeui
    Participant

    hi,

    how do you structure JS folder for scripts?

    each library, having its own folder, files inside


    js/
    js/jquery.1.6.2.js

    js/bootstrap/
    js/jquery/
    js/jquery-tools/

    or

    do you have folder and all files in it like this

    js/
    js/jquery.1.6.2.js

    js/bootstrap.alerts.js
    js/bootstrap.modal.js

    js/jquery.lightbox.js
    js/jquery.slider.js

    js/jquery-tools.carousel.js
    js/jquery-tools.tabs.js
    #87593
    jamygolden
    Member

    I like the way html5 boilerplate does it.

    /js/libs/jquery.1.6.2.js
    /js/libs/modernizr.js
    /js/script.js
    /js/plugins.js
    #87597
    jamygolden
    Member

    Well, if it’s a library, I’d put it under “/js/libs/whatever.js” (no file concatenation since it’s a library which you may update fairly often)

    If it’s your own script, I’d drop it all under script.js and if it’s a plugin I’d add them all to plugins.js. This way you minimize on your http requests.

    Where you put the files is just a preference. The file concatenation is a good way to go though, since each http request kills off 1 loving kitten somewhere in the world.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.