gpt4 book ai didi

javascript - Grunt 构建 useminprepare 不起作用

转载 作者:行者123 更新时间:2023-11-28 06:56:42 25 4
gpt4 key购买 nike

我的脚本和 grunt 有问题。我无法让咕噜声将我的脚本“复制”到 dist。

因此 useminPrepare 不包含或复制 Bower_components。

这是我的 grunt 文件:http://pastebin.com/1aFMABam

这里是useminPrepare

useminPrepare: {
options: {
dest: '<%= config.dist %>'
},
html: '.tmp/index.html'
},

我得到的 HTML:

<!-- build:js(.) scripts/vendor.js-->
<!-- bower:js-->
<script src="/bower_components/modernizr/modernizr.js"></script>
<script src="/bower_components/jquery/dist/jquery.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap.js"></script>
<script src="/bower_components/bootstrap-switch/dist/js/bootstrap-switch.js"></script>
<script src="/bower_components/sifter/sifter.js"></script>
<script src="/bower_components/microplugin/src/microplugin.js"></script>
<script src="/bower_components/selectize/dist/js/selectize.js"></script>
<script src="/bower_components/tinymce/tinymce.min.js"></script>
<script src="/bower_components/chai/chai.js"></script>
<script src="/bower_components/mocha/mocha.js"></script>
<!-- endbower-->
<!-- endbuild-->
<!-- build:js(.) scripts/plugins.js-->
<!-- endbuild-->
<!-- build:js scripts/main.js-->
<script src="scripts/main.js"></script>
<!-- endbuild-->

以及我的脚本文件夹输出。

Script
|- Vendor
|- modernizr.js

我想要的结果

我想获取其文件夹中的每个组件,如下所示:

<script src="script/jquery/jquery.js"></script>
<script src="script/angular/angular.js"></script>
<script src="script/etc/etc.js"></script>

顺便说一句:它甚至不包括 main.js!

任务调试

Loading "usemin.js" tasks...OK
+ usemin, useminPrepare

Running "useminPrepare" task

Running "useminPrepare:html" (useminPrepare) task
Verifying property useminPrepare.html exists in config...OK
Files: [no src] -> html
Options: dest="dist"
Going through to update the config
Looking for build script HTML comment blocks

Configuration is now:

concat:
{ dist: {} }

uglify:
{ dist: { files: { '<%= config.dist %>/scripts/scripts.js': [ 'dist/scripts/scripts.js' ] } } }

cssmin:
{ dist:
{ files:
{ '<%= config.dist %>/styles/main.css':
[ '.tmp/styles/{,*/}*.css',
'app/styles/{,*/}*.css' ] } } }

Done, without errors.


Execution Time (2015-09-11 06:43:02 UTC)
loading tasks 246ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 73%
loading grunt-usemin 68ms ▇▇▇▇▇▇▇▇▇ 20%
useminPrepare:html 25ms ▇▇▇ 7%
Total 339ms

最佳答案

我通过更改 useminprepare 的源解决了这个问题,因为 src 位于 .tmp 上,而 james:dist 不会在那里编译 HTML,它会直接编译构建。

关于javascript - Grunt 构建 useminprepare 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32517161/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com