合并js文件minify实例
将min目录放入项目中后,js中引入方式是:
<script type="text/javascript" src="__PUBLIC__/min/?b=public&f=Js/Jquery/jquery-1.8.2.js,Js/Jquery/jquery-ui-1.9.2.custom.min.js"></script>
如果用到分组的话,上面的就不合适了。
分组实例:
1.config.php
$min_serveOptions['minApp']['allowDirs'] = array('//jsOne', '//jsTwo', '//jsThree', '//jsFour', '//jsFive', '//jsSix');
2.groupsConfig.php
return array( 'jsOne' => array('//public/Js/redidai.js', '//public/Js/redidai.common.js', '//public/Js/redidai.login.js', '//public/Js/Jquery/jquery.cookie.js', '//public/Js/common.js', '//public/redidai/plan1.4/js/redidai.ajax.operate.js'), 'jsTwo' => array('//public/Js/autocomplete/plugin/jquery-pre-build/ui/jquery.ui.core.js', '//public/Js/autocomplete/plugin/jquery-pre-build/ui/jquery.ui.widget.js', '//public/Js/autocomplete/plugin/jquery-pre-build/ui/jquery.ui.position.js', '//public/Js/autocomplete/plugin/jquery-pre-build/ui/jquery.ui.autocomplete.js'), 'jsThree' => array('//public/Js/redidai.passport.js', '//public/Js/Jquery/formvalidator/formValidator-4.1.3.js', '//public/Js/Jquery/formvalidator/formValidatorRegex-4.1.3.js'), 'jsFour' => array('//public/Js/hoverIntent.js', '//public/Js/superfish.js'), 'jsFive' => array('//public/Js/Jquery/jquery-1.8.2.js', '//public/Js/Jquery/jquery-ui-1.9.2.custom.min.js'), 'jsSix' => array('//public/Js/Jquery/jquery-ui-1.9.0.custom.min.js', '//public/Js/head.load.min.js', '//public/redidai/plan1.4/js/placeholder.js', '//public/Js/Jquery/jquery.cookies.js', '//public/Js/Jquery/jquery.tmpl.min.js'), );
3.调用:
<script type="text/javascript" src="__PUBLIC__/min/?g=jsFive"></script>