Loading ...
Sorry, an error occurred while loading the content.

Re: [jslint] Re: Controlling compressors

Expand Messages
  • Jakob Kruse
    This is very compressor specific, is it not? Both comments would be removed (regardless of your choice of snippet) by JSMin and YUI Compressor for instance,
    Message 1 of 6 , Aug 8, 2012
    • 0 Attachment
      This is very compressor specific, is it not? Both comments would be removed (regardless of your choice of snippet) by JSMin and YUI Compressor for instance, but with YUI Compressor you can prevent the removal of any comment by starting it with "/*!". This seems like a much better idea than filling your source files with garbage code, IMHO.


      /Jakob

      _____

      From: Tom Worster [mailto:fsb@...]
      To: jslint_com@yahoogroups.com
      Sent: Wed, 08 Aug 2012 15:53:52 +0200
      Subject: Re: [jslint] Re: Controlling compressors






      On 8/8/12 9:28 AM, "douglascrockford" <douglas@...> wrote:

      >--- In jslint_com@yahoogroups.com, Tom Worster <fsb@...> wrote:
      >> Some compressors do not touch the initial comments of a file in order to
      >> leave copyright, license etc. in place. I find that useful. However,
      >>some
      >> of my files have comments after the public notices but before the first
      >> lines of actual script that I would prefer to not see in the compressed
      >> file. I can do that by separating these two passages of comments with a
      >> bit of JS code.
      >>
      >> But I haven't come up with a separator that has no other purpose or
      >>effect
      >> that both I and JSLint like.
      >>
      >> What's a JSLint-friendly bit of trivial code for this purpose?
      >
      >
      >Could you be more sepecific?

      Sure. I'd like to have a source code file that begins like this:

      /* Public copyright notice not to be compressed */

      ;

      /* Code comments the compressor should remove */
      var PLUM = function {

      and continues from there to the end of the file.

      JSLint does not like that ; and I'm not particularly attached to it. So
      what is a tiny nugget of JSLint-friendly code that has no side effects or
      purpose besides turning on the compressor's removal of comments?

      The best I could come up with was:

      (function () {
      'use strict';
      }());

      which maybe shows how bad my imagination and understanding of the language
      really is.




      [Non-text portions of this message have been removed]
    • sandyhead25
      I have found the following code works in both my Pretty Diff application and the JSLint tool: /*prettydiff.com api.topcoms: true*/ /*license here*/ var a;
      Message 2 of 6 , Aug 8, 2012
      • 0 Attachment
        I have found the following code works in both my Pretty Diff application and the JSLint tool:



        /*prettydiff.com api.topcoms: true*/
        /*license here*/

        var a; //arbitrary code here

        /*throw away comment here*/

        var b;



        I would have thought JSLint would throw an error for multiple uses of the "var" keyword in any single scope, but apparently not in the global scope.

        Austin

        --- In jslint_com@yahoogroups.com, Tom Worster <fsb@...> wrote:
        >
        > Some compressors do not touch the initial comments of a file in order to
        > leave copyright, license etc. in place. I find that useful. However, some
        > of my files have comments after the public notices but before the first
        > lines of actual script that I would prefer to not see in the compressed
        > file. I can do that by separating these two passages of comments with a
        > bit of JS code.
        >
        > But I haven't come up with a separator that has no other purpose or effect
        > that both I and JSLint like.
        >
        > What's a JSLint-friendly bit of trivial code for this purpose?
        >
      • Tom Worster
        ... i don t know. ... one redundant ; does not amount filling a source file with garbage code. tolerating it and the resulting JSList warning remains an
        Message 3 of 6 , Aug 8, 2012
        • 0 Attachment
          On 8/8/12 10:11 AM, "Jakob Kruse" <kruse@...> wrote:

          >This is very compressor specific, is it not?

          i don't know.


          >Both comments would be removed (regardless of your choice of snippet) by
          >JSMin and YUI Compressor for instance, but with YUI Compressor you can
          >prevent the removal of any comment by starting it with "/*!". This seems
          >like a much better idea than filling your source files with garbage code,
          >IMHO.

          one redundant ; does not amount filling a source file with garbage code.
          tolerating it and the resulting JSList warning remains an option.
        Your message has been successfully submitted and would be delivered to recipients shortly.