我无法向我的第一个Shopware5主题添加javascript文件。我尝试了在一篇在线文章中给出的以下方法。https://developers.shopware.com/designers-guide/theme-startup-guide/ --我将js文件添加到Theme.php文件的数组中,并将javascript文件上传到“前端/_public/src/js”
/** @var array Defines the files which should be compiled by the
javascript compressor */
protected $javascript = array(
'src/js/jquery.my-plugin.js'
);但是,上面的数组在我的Theme.php文件上是不可删除的,但是我将js文件添加到数组中,并尝试将它加载到我的主题上。当我检查这个网站时,我清理了我所有的隐藏室。
发布于 2016-02-10 17:50:10
您必须清除所有缓存并重新编译主题。请记住,您必须将js放入frontend/_public中。
js-文件的完整路径应该是themes/YourTheme/frontend/_public/src/js/jquery.my-plugin.js。
https://stackoverflow.com/questions/35314998
复制相似问题