【问题标题】:What is the syntax for a comment in a client library js.txt file?客户端库 js.txt 文件中注释的语法是什么?
【发布时间】:2016-10-21 21:59:45
【问题描述】:

向客户端库 js.txtcss.txt 文件添加注释的语法是什么?

似乎以# 开头的行用作注释,而似乎// 开头的行用作注释。但是/* */ 块在构建库时会导致异常。由于#base=[root]special meaning,这让我想知道# 是否真的 是添加评论的合适方式,或者它是否用于其他目的。这让我想知道// 是否真的可以发表评论,或者 AEM 是否只是将其视为不存在文件的相对路径。

有人知道客户端库的 js.txt 或 css.txt 文件中注释的适当语法的确切答案吗?

【问题讨论】:

  • 我将赌注# 是一个有效的评论行,不包括#base。对于其余的评论格式,它可能正在尝试解析这些路径。如果您为/* */ 块获得RepositoryException,那么根据Session.itemExists API 可能是有意义的。

标签: aem client-library


【解决方案1】:

# 在客户端库js.txtcss.txt 中的cmets 中使用是安全的。例如,Adobe 将其用于其版权免责声明:

###############################################################################
# Copyright 2016 Adobe Systems Incorporated
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################

#base=./js
modals.js

在 GitHub 上查看官方 We Retail 演示内容:We Retail Clientlib Example on www.github.com

【讨论】:

    【解决方案2】:
    (hash) Import-Package: *
    

    在导入或导出我们的包时,我们必须取消注释这些行。但在 js.txt 或 css.txt 的情况下保持相同:

    (hash)base=js
    

    所以 (hash) 是评论的方式,但有时它不是评论。

    【讨论】:

      猜你喜欢
      • 2012-07-31
      • 2015-12-10
      • 2010-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多