在 GWT 2.0 CssResource 中,如何关闭所有 css 类的混淆?

发布于 2024-11-06 19:45:07 字数 520 浏览 0 评论 0原文

我有一个 CssResource,我想将一些 css 类“映射”到方法:

@ClassName("top-table")
String topTable();

但我想关闭 GWT 所做的混淆(至少在开发时,为了更好地在 firebug 中进行调试等)。

有没有一种简单的方法可以实现这一目标?我知道我可以在我的css文件中使用@external,但是我必须定义所有的css类,例如@external .c1、.c2、.c3等...像

@external .*之类的东西可以解决我的问题,但这并不能解决我的问题似乎至少在 gwt 2.0.x 中不可用

我当前的解决方案是使用:

<set-configuration-property name="CssResource.style" value="pretty"/>

但这并没有关闭混淆,只是使它更漂亮:) 我知道需要 obf 来避免冲突,但是我的情况没有这个,并且真的很想关闭混淆

I have a CssResource where I want to have some of the css classes "mapped" to methods:

@ClassName("top-table")
String topTable();

But I want to turn off the obfuscation GWT does (while developing at least, for better debugging in firebug, etc).

Is there an easy way to achieve this? I know I can use @external in my css file but then I have to define all my css classes like @external .c1, .c2, .c3, etc...

Something like @external .* would solve my problem but that doesn't seem to be available at least in gwt 2.0.x

My current solution is to use:

<set-configuration-property name="CssResource.style" value="pretty"/>

But that doesn't turn off the obfuscation, just makes it prettier :) I know obf is needed to avoid collisions but I don't have that in my case and would really like to turn off obfuscation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

韶华倾负 2024-11-13 19:45:07

要立即禁用所有旧类的混淆,您可以利用此处< /a>

简而言之,在使用 CssResource 捆绑包绑定的旧 css 文件中,放置此声明: @external .*;

具有此声明文件的文件中的所有类都不会被混淆了。

To disable obfuscation for all of you legacy classes at once, you can exploit what is said here

In short, in the legacy css file, which you are binding using CssResource bundle, put this declaration: @external .*;

All the classes in the file that has this declaration file will not be obfuscated.

夏天碎花小短裙 2024-11-13 19:45:07

根据 GWT 文档,通常可以禁用总线连接。来自 CssResource 部分“控制杆和旋钮”

配置属性CssResource.style可以设置为pretty
这将禁用类名混淆并漂亮地打印
CSS 内容。将此值与 ClientBundle.enableInlined 值结合起来
false 生成适合客户端的 CSS 表达式
编辑。

在我的工作 GWT 项目中,我可以看到这个属性实际上是在 Resources.gwt.xml (包含在 gwt-user.jar 中)中设置的:

  <!-- This can be used to make CssResource produce human-readable CSS -->
  <define-configuration-property name="CssResource.style" is-multi-valued="false" />
  <set-configuration-property name="CssResource.style" value="obf" />

我不清楚的是如何覆盖这个值,因为它已经设置了。你想明白了吗?

According to the GWT documentation it is possible to disable ofbuscation in general. From CssResource section "levers and knobs":

The configuration property CssResource.style may be set to pretty
which will disable class-name obfuscation as well as pretty-print the
CSS content. Combine this with a ClientBundle.enableInlining value of
false to produce a CSS expression which is amenable to client-side
editing.

In my work GWT project, I can see this property is actually set in Resources.gwt.xml (included in gwt-user.jar):

  <!-- This can be used to make CssResource produce human-readable CSS -->
  <define-configuration-property name="CssResource.style" is-multi-valued="false" />
  <set-configuration-property name="CssResource.style" value="obf" />

What is unclear to me is how to override this value, since it is already set. Did you manage to figure that out?

羁拥 2024-11-13 19:45:07

为了不混淆类名,您只需将以下行添加到 gwt.xml 文件中:

  <set-configuration-property name="CssResource.style" value="stable" />

当设置为稳定的类名时,将包含限定的类名,后跟资源接口中的方法名(当然,所有 . 都替换为 _)

CssResource.style(对于 gwt 2.7)的所有可能值是:

  • Pretty
  • debug
  • stable
  • stable-shorttype
  • stable-notype

要验证适用于您的 gwt 版本的值,请查看com.google.gwt.resources.rg.CssObfuscationStyle 您正在使用的 gwt 版本的 javadoc(或源代码)。

To have not obfuscated class names you simply need to add following line to your gwt.xml file:

  <set-configuration-property name="CssResource.style" value="stable" />

When set to stable class names will consist of qualified class name followed by method name in your resource interfaces (of course with all . replaced by _)

All possible values for CssResource.style (for gwt 2.7) are:

  • pretty
  • debug
  • stable
  • stable-shorttype
  • stable-notype

To verify values available for your gwt version look at com.google.gwt.resources.rg.CssObfuscationStyle javadoc (or source code) for gwt version you're using.

爱的十字路口 2024-11-13 19:45:07

您可以使用@external指令< /a> 以防止 css 类名被混淆。

在你的情况下,你的 css 文件可能包含

@external top-table;
.top-table {
  some: rule;
}

You can use the @external directive to prevent a css classname from being obfuscated.

In your case, your css file might contain

@external top-table;
.top-table {
  some: rule;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文