Problem comparing javascript files with long lines

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rick Steinwand
    Expert
    • May 2008
    • 55

    Problem comparing javascript files with long lines

    Hi.
    I'm noticing a problem when I merge two large (>100k) javascript files containing many scripts from different sources and some of the content is packed or compressed (jQuery) so a 50k library occupies just one line.

    I believe what happens is I get CRLF's at the end of every line so it looks ok after merging until I click the reload button and now I have extra blank lines for every-other line in that script. Once I copy over the changes to that section again (removing the extra linefeeds), everything is ok.
  • Chris
    Team Scooter
    • Oct 2007
    • 5538

    #2
    Rick,

    BC defaults to wrapping long lines at 4096 characters. If lines in your files are longer than the default value, you'll need to increase it. To increase the value, select "Tools > File Formats" from the menu. Select the format for your files, then go to the Conversion tab. Increase the "characters per line limit" value to a value larger than your longest line.
    Chris K Scooter Software

    Comment

    • Rick Steinwand
      Expert
      • May 2008
      • 55

      #3
      Thanks Chris.

      Looks like it's using "text format" rules for JS. Guess I'll have to create one for scripts.

      The length for that jQuery right now is 30777.
      Last edited by Rick Steinwand; 20-Mar-2009, 02:34 PM.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16009

        #4
        Hello,

        Just make sure that file format is applied automatically by having it be the topmost file format in the Tools menu -> File Formats dialog with a matching file mask ("*.js;*.jscript"?)

        That way, it is also the file format that is applied by default for scripts whenever a rules-based comparison is used (for a report or folder compare rules-based comparison).
        Aaron P Scooter Software

        Comment

        • Rick Steinwand
          Expert
          • May 2008
          • 55

          #5
          Hi Aaron.

          I'm also having an issue with Source Integrity where it sees a 30+k line (jQuery again) and assumes the js file is a binary and I can't update or compare to the original file.

          Cutting the line lengths down to a more-normal size (adding LF in appropriate places) seems to fix both problems.

          FWIW, the online compaction using this page seems very good. Many of the ones I tested, just introduces JS errors.

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 16009

            #6
            How large are your files? Would you be able to send a pair of sample files and your Support package (Help menu -> Support; Export) to [email protected] ?

            Please include a link to this forum post as well. Thanks.

            You may need to rename your files to .txt to get them past spam filters.
            Last edited by Aaron; 27-Mar-2009, 03:13 PM. Reason: Txt tip to get past spam filters
            Aaron P Scooter Software

            Comment

            • Rick Steinwand
              Expert
              • May 2008
              • 55

              #7
              Done.

              Comment

              Working...