什么是javascript文件名命名约定? [英] What is the javascript filename naming convention?
本文介绍了什么是javascript文件名命名约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
应该将文件命名为some-with-hyphens.js,camelCased.js还是其他什么?
Should files be named something-with-hyphens.js, camelCased.js, or something else?
我没有找到这个问题的答案这里。
I didn't find the answer to this question here.
推荐答案
一种可能的命名约定是使用与jQuery使用的命名方案类似的东西。它并非普遍采用,但很常见。
One possible naming convention is to use something similar to the naming scheme jQuery uses. It's not universally adopted but it is pretty common.
product-name.plugin-ver.sion.filetype.js
其中产品名称
+ 插件
对也可以代表 命名空间和模块 。 版本
和文件类型
通常是可选的。
where the product-name
+ plugin
pair can also represent a namespace and a module. The version
and filetype
are usually optional.
filetype
可以是与文件内容相关的内容。常见的是:
filetype
can be something relative to how the content of the file is. Often seen are:
-
min
用于缩小文件 -
自定义构建或修改文件的自定义
min
for minified filescustom
for custom built or modified files
示例:
-
jquery-1.4.2.min.js
-
jquery.plugin-0.1.js
-
myapp.invoice.js
jquery-1.4.2.min.js
jquery.plugin-0.1.js
myapp.invoice.js
这篇关于什么是javascript文件名命名约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文