代码有什么问题
我想在加载时将 a.js 和 b.js 合二为一
配置.yml
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: ['AcmeDemoBundle']
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
#yui_css:
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
uglifyjs2: %kernel.root_dir%
查看文件
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="" content="">
<link href="<?php echo $view['assets']->getUrl('bundles/acmedemo/css/a.css') ?>" rel="stylesheet" type="text/css" />
<!--<script src="<?php echo $view['assets']->getUrl('bundles/acmedemo/js/a.js') ?>" type="text/javascript" /></script>-->
<?php foreach ($view['assetic']->javascripts(
array('@AcmeDemoBundle/Resources/public/js/a.js',
'@AcmeDemoBundle/Resources/public/js/b.js'
),
array('uglifyjs2')
) as $url): ?>
<script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
</head>
<body>
<div class="c2">Hello</div>
</body>
</html>
控制器
/**
* @Route("/test", name="_demo_contact")
* @Template()
*/
public function testAction(){
return $this->render('AcmeDemoBundle:Demo:a.html.php');
}