如题
我用vs2010,js文件写的比较长,不知道js有没有收缩的功能,就跟后台差不多的

解决方案 »

  1.   

    我曾今问过,里面有方法
    http://topic.csdn.net/u/20100430/16/6b9ceb83-e31f-43cf-91bc-ac0a0c47f7f5.html
      

  2.   

    可以在服务器端使用gzip工具自动压缩,也可以用JS Minifier 压缩后上传。
    http://www.jb51.net/tools/jsmin/  JS Minifier js压缩 
      

  3.   

    可以的,打开Macro资源管理器,添加一个文件,把如下代码复制,粘贴上去,保存就好了。希望可以帮助你。代码如下:
    Option Strict Off
    Option Explicit OffImports System
    Imports EnvDTE
    Imports EnvDTE80
    Imports System.Diagnostics
    Imports System.CollectionsPublic Module JSRegion    Sub OutlineRegions()
            Dim selection As EnvDTE.TextSelection = DTE.ActiveDocument.Selection        Const REGION_START As String = "//#region"
            Const REGION_END As String = "//#endregion"        selection.SelectAll()
            '农民伯伯 --- 自动为"//#endregion"结束的代码添加最后一行,不然出错
            If selection.Text.EndsWith(REGION_END) Then
                selection.EndOfLine()
                selection.NewLine()
                selection.SelectAll()
            End If
            Dim text As String = selection.Text
            selection.StartOfDocument(True)        Dim startIndex As Integer
            Dim endIndex As Integer
            Dim lastIndex As Integer = 0
            Dim startRegions As Stack = New Stack()        Do
                startIndex = text.IndexOf(REGION_START, lastIndex)
                endIndex = text.IndexOf(REGION_END, lastIndex)            If startIndex = -1 AndAlso endIndex = -1 Then
                    Exit Do
                End If            If startIndex <> -1 AndAlso startIndex < endIndex Then
                    startRegions.Push(startIndex)
                    lastIndex = startIndex + 1
                Else
                    ' Outline region 
                    selection.MoveToLineAndOffset(CalcLineNumber(text, CInt(startRegions.Pop())), 1)
                    selection.MoveToLineAndOffset(CalcLineNumber(text, endIndex) + 1, 1, True)
                    selection.OutlineSection()                lastIndex = endIndex + 1
                End If
            Loop        selection.StartOfDocument()
        End Sub    Private Function CalcLineNumber(ByVal text As String, ByVal index As Integer)
            Dim lineNumber As Integer = 1
            Dim i As Integer = 0        While i < index
                If text.Chars(i) = vbCr Then
                    lineNumber += 1
                    i += 1
                End If            i += 1
            End While        Return lineNumber
        End Function
    End Module
      

  4.   

    我有,一直在用,很不错的函数折叠功能
    javascript折叠插件:PluginForJS:
    http://www.cnblogs.com/yuyijq/archive/2008/06/24/1229228.html
    安装很方便:
      
      

  5.   

    luqian_7 的我试过,不好用 需要选择一段然后输入名称才收缩,在编写html的时候,就很烦人,选择一段代码,他就弹出选择折叠,没想折叠也弹出。