Naming convention for assets (images, css, js)?

前端 未结 9 596
孤城傲影
孤城傲影 2021-01-29 20:33

I am still struggling to find a good naming convention for assets like images, js and css files used in my web projects.

So, my current would be:

CSS:

相关标签:
9条回答
  • 2021-01-29 20:58
    /Assets/
      /Css
      /Images
      /Javascript (or Script)
        /Minified
        /Source
    

    Is the best structure I've seen and the one I prefer. With folders you don't really need to prefix your CSS etc. with descriptive names.

    0 讨论(0)
  • 2021-01-29 21:02

    You can name it like this:

    /assets/css/ - For CSS files

    /assets/font/ - For Font files. (Mostly you can just go to google fonts to search for usable fonts.)

    /assets/images/ - For Images files.

    /assets/scripts/ or /assets/js/ - For JavaScript files.

    /assets/media/ - For video and misc. files.

    You can also replace "assets" with "resource" or "files" folder name and keep the name of it's subfolders. Well having an order folder structure like this isn't very important the only important is you just have to arrange your files by it's format. like creating a folder "/css/" for CSS files or "/images/" for Image files.

    0 讨论(0)
  • 2021-01-29 21:04

    I place CSS files in a folder css, Javascript in js, images in images, ... Add subfolders as you see fit. No need for any naming convention on the level of individual files.

    0 讨论(0)
提交回复
热议问题