以/ *开头的JavaScript评论! [英] JavaScript comment starting with /*!

查看:124
本文介绍了以/ *开头的JavaScript评论!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的编辑器( Geany )在评论开头时更改评论的颜色code> / *!。 / * ... * / / *之间的区别是什么! ... * /

My editor (Geany) changes the colour of a comment when a comment starts with /*!. What's the difference between /* ... */ and /*! ... */?

推荐答案

!防止YUI压缩器在压缩时删除注释。 (它只是删除1!而不是。多个!意味着你可以多次压缩而不会丢失评论。)这只是一个扩展,但不是javascript本身的一部分。

The ! prevents YUI compressor from removing the comment when it compresses. (It just removes 1 ! instead. Multiple !'s mean you can compress multiple times without loss of the comment.) It's just an extension, but not part of javascript itself.

文档是此处。搜索'C风格的评论'。

Documentation is here. Search for 'C-style comments'.

此外,我不知道有任何其他压缩机尊重! Packer 封闭编译器 shrinksafe jsmin 至少不尊重它。

also, I'm not aware of any other compressors that respect the !. Packer, closure compiler, shrinksafe, and jsmin do not respect it at least.

这篇关于以/ *开头的JavaScript评论!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆