<tfoot id='uBxNJ'></tfoot>

<small id='uBxNJ'></small><noframes id='uBxNJ'>

  • <legend id='uBxNJ'><style id='uBxNJ'><dir id='uBxNJ'><q id='uBxNJ'></q></dir></style></legend>

        <i id='uBxNJ'><tr id='uBxNJ'><dt id='uBxNJ'><q id='uBxNJ'><span id='uBxNJ'><b id='uBxNJ'><form id='uBxNJ'><ins id='uBxNJ'></ins><ul id='uBxNJ'></ul><sub id='uBxNJ'></sub></form><legend id='uBxNJ'></legend><bdo id='uBxNJ'><pre id='uBxNJ'><center id='uBxNJ'></center></pre></bdo></b><th id='uBxNJ'></th></span></q></dt></tr></i><div id='uBxNJ'><tfoot id='uBxNJ'></tfoot><dl id='uBxNJ'><fieldset id='uBxNJ'></fieldset></dl></div>
        • <bdo id='uBxNJ'></bdo><ul id='uBxNJ'></ul>

        Gulp注入不起作用

        时间:2023-05-29

          <bdo id='Jfk7y'></bdo><ul id='Jfk7y'></ul>

              <small id='Jfk7y'></small><noframes id='Jfk7y'>

                <tbody id='Jfk7y'></tbody>
            1. <i id='Jfk7y'><tr id='Jfk7y'><dt id='Jfk7y'><q id='Jfk7y'><span id='Jfk7y'><b id='Jfk7y'><form id='Jfk7y'><ins id='Jfk7y'></ins><ul id='Jfk7y'></ul><sub id='Jfk7y'></sub></form><legend id='Jfk7y'></legend><bdo id='Jfk7y'><pre id='Jfk7y'><center id='Jfk7y'></center></pre></bdo></b><th id='Jfk7y'></th></span></q></dt></tr></i><div id='Jfk7y'><tfoot id='Jfk7y'></tfoot><dl id='Jfk7y'><fieldset id='Jfk7y'></fieldset></dl></div>

                <legend id='Jfk7y'><style id='Jfk7y'><dir id='Jfk7y'><q id='Jfk7y'></q></dir></style></legend>

                  <tfoot id='Jfk7y'></tfoot>
                  本文介绍了Gulp注入不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试使用 gulp-inject 将一些文件注入 PHP 文件.这是行不通的.我也尝试过使用 HTML,但这不起作用.我的控制台中的输出显示gulp-inject 6 files into test.html"但是没有注入文件.# of files 是正确的,因为我在 Gulp 文件中查看的目录中有 6 个 JavaScript 文件.这是我的 Guilp 任务:

                  I'm try to use gulp-inject to inject some files into a PHP file. This is not working. I tried using HTML as well but that isn't working. The output in my console says "gulp-inject 6 files into test.html" however there's no files injected. The # of files is correct because I do have 6 JavaScript files in the directory i'm looking at in my Gulp file. Here's my Guilp task:

                  var inject = require('gulp-inject');
                  
                  gulp.task('build',function() {
                  
                      return gulp.src("src/test.html")
                      .pipe(inject(gulp.src("src/vendor/js/*.js")));
                  
                  });
                  

                  我的 test.html 文件如下所示:

                  My test.html file looks like this:

                  <!DOCTYPE html>
                  <html>
                  <head>
                      <title>My index</title>
                      <!-- inject:css -->
                      <!-- endinject -->
                  </head>
                  <body>
                  
                  <!-- inject:js -->
                  <!-- endinject -->
                  </body>
                  </html>
                  

                  同样,src/vendor/js 目录包含 6 个文件,控制台中 Gulp 的输出显示 6 个文件已添加到 test.html,但没有添加任何内容.我的目标是用 PHP 做到这一点,但没有工作,所以我在这里用 HTML 进行测试,但仍然没有.

                  Again, the src/vendor/js directory contains 6 files and the output from Gulp in the console is saying 6 files were added to test.html, but nothing is added. My goal was to do this with PHP but wasn't working so I was testing here with HTML and still, nothing.

                  有什么想法吗?

                  非常感谢.

                  推荐答案

                  文件被注入...但只是在内存中!您实际上必须将结果通过管道传输到文件:

                  The files were injected...but just in memory ! You actually have to pipe the result to a file :

                  gulp.task('build',function() {
                      return gulp.src("src/test.html")
                      .pipe(inject(gulp.src("src/vendor/js/*.js")))
                      .pipe(gulp.dest('./dist')); // or .src/ or whatever
                  });
                  

                  自述文件中还有其他示例

                  这篇关于Gulp注入不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Gulp concat 和需要路径 下一篇:使用browserify打包React组件

                  相关文章

                  最新文章

                1. <small id='XcjwV'></small><noframes id='XcjwV'>

                      <bdo id='XcjwV'></bdo><ul id='XcjwV'></ul>
                    <tfoot id='XcjwV'></tfoot>
                  1. <i id='XcjwV'><tr id='XcjwV'><dt id='XcjwV'><q id='XcjwV'><span id='XcjwV'><b id='XcjwV'><form id='XcjwV'><ins id='XcjwV'></ins><ul id='XcjwV'></ul><sub id='XcjwV'></sub></form><legend id='XcjwV'></legend><bdo id='XcjwV'><pre id='XcjwV'><center id='XcjwV'></center></pre></bdo></b><th id='XcjwV'></th></span></q></dt></tr></i><div id='XcjwV'><tfoot id='XcjwV'></tfoot><dl id='XcjwV'><fieldset id='XcjwV'></fieldset></dl></div>

                    <legend id='XcjwV'><style id='XcjwV'><dir id='XcjwV'><q id='XcjwV'></q></dir></style></legend>