Maven Javascript Compressor

前端 未结 3 1146
深忆病人
深忆病人 2021-01-04 21:59

I want to know how one can compress javascriptfiles using maven. I have lready visited webistes like http://mojohaus.org/javascript-maven-tools/guide-webapp-development.ht

3条回答
  •  逝去的感伤
    2021-01-04 22:32

    I suggest using the YUI Compressor Maven Mojo and its yuicompressor:compress goal instead. It is well documented, it just works.

    To use it, add the following pluginRepository:

      
        
          oss.sonatype.org - github-releases
          oss.sonatype.org-github-releases
          http://oss.sonatype.org/content/repositories/github-releases
        
      
    

    And declare the plugin:

    
      ...
      
        
        
          
            
              net.alchim31.maven
              yuicompressor-maven-plugin
              0.9
            
            ...
          
        
        
        
          
            net.alchim31.maven
            yuicompressor-maven-plugin
            
              
                
                  compress
                
              
               
          
          ...
        
      
      ...
    
    

    Refer to the Usage page and the parameters of yuicompressor:compress for precise configuration.

提交回复
热议问题