Shawn
Shawn

Reputation: 9412

What is the syntax for a comment in a client library js.txt file?

What is the syntax for adding a comment to a client library js.txt or css.txt file?

It appears that a line prefaced with # works as a comment, and it appears that a line prefaced with // works as a comment. But /* */ blocks cause exceptions when the library is built. Since #base=[root] has special meaning, it makes me wonder if # is really an appropriate way to add a comment or if it is meant for something else. It makes me wonder if // is really valid to make a comment or if AEM just treats this as a relative path to a file that doesn't exist.

Anyone know the definitive answer on the appropriate syntax for a comment in the js.txt or css.txt file of a client library?

Upvotes: 5

Views: 1173

Answers (2)

Gutter Overflow
Gutter Overflow

Reputation: 149

(hash) Import-Package: *

We have to uncomment these lines while importing or exporting our bundle. But keep the same in case of js.txt or css.txt:

(hash)base=js

So (hash) is the way to comment but sometimes it is not a comment.

Upvotes: 0

Jens
Jens

Reputation: 21520

The # is safe to use in comments in a clientlibs js.txt and css.txt. Adobe for example uses this for their Copyright disclaimer:

###############################################################################
# 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

See official We Retail demo content on GitHub: We Retail Clientlib Example on www.github.com

Upvotes: 3

Related Questions