Skip to content Skip to sidebar Skip to footer

Clear Case. How To Split Very Long Javascript On Multiple Lines?

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 clearcas

Solution 1:

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

cleartool chtypeCompressed_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".

Solution 2:

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.

Solution 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.

Post a Comment for "Clear Case. How To Split Very Long Javascript On Multiple Lines?"