Clear Case. How to split very long javascript on multiple lines?

▼魔方 西西 提交于 2019-12-12 13:28:02

问题


I have a JS compressed file which is long about 14k and it is on one single line. This creates some problem on Clear Case, making check in impossible

Is there a way to fix clearcase?

If I whant to split the JS file on multiple lines, should I pay attention to something when inserting line breaks. Obviously I won't split a string or anumber, after that any other non obvious thing to keep in mind?


回答1:


I don't know about ClearCase. A safe place to split is after a ; or } outside of a string constant since there shouldn't be any comments in compressed JS.

You can also split the file manually; the file probably doesn't change often and 10 line feeds more or less won't hurt the performance.




回答2:


The other solution would be to change the type of your compressed JS file to... "compressed_file":

cleartool chtype Compressed_file

That way, you wouldn't have to modify your file.
See "Clearcase issue while “add file to source control”" for more on that technique.

You can also specify the merge manager to always copy over that file when merged, to avoid any merge issue. See "Clearcase UCM is trying to merge pdf files".




回答3:


Yes, line-breaks have a syntactic meaning in JS. A javascript instruction is terminated either by a semicolon or a line-break (or, what's usually the case, both). When the whole script was written without linebreaks, the only way to separate the instructions were semicolons. So when you add a line-break after every semicolon, the syntactical meaning should stay the same.

But are you sure that you should check-in the compressed Javascript code and not the original, uncompressed version? Especially when you have to edit it to do so? Artifacts, like compiled binaries, usually don't belong into version control. A compressed JS file should also be treated like that, in my opinion.



来源:https://stackoverflow.com/questions/12351143/clear-case-how-to-split-very-long-javascript-on-multiple-lines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!