简体   繁体   English

gulp.dest不适用于gulp useref

[英]gulp.dest is not working for gulp useref

I'm trying to use gulp useref to merge my bower js files, app js files and css but its not working for me. 我正在尝试使用gulp useref合并我的Bower js文件,app js文件和CSS,但对我不起作用。 My dest directory is always empty when i run gulp command 当我运行gulp命令时,我的dest目录始终为空

Here is my directory structure which is generated using yomean 这是我使用yomean生成的目录结构

   app
      bower_components
      main
      img
   dest
   gulp
   hooks
   node_modules

This is my index.html 这是我的index.html

<!-- build:js scripts/app.js -->
<!-- inject:js -->
<script src="app.js"></script>
<script src="main/main.js"></script>
<script src="main/constants/config-const.js"></script>
<script src="main/controllers/badge.controller.js"></script>
<script src="main/controllers/creation.controller.js"></script>
<!-- endinject -->
<!-- endbuild -->

My gulp.js looks like this 我的gulp.js看起来像这样

gulp.task('useref', function(){
     return gulp.src('app/main/*.html')
    .pipe(useref())
    .pipe(gulp.dest('dest'),{relative: true});
   });

useref task runs fine as i see it in my terminal console but for some reason dest directory does not have resultant file in it 正如我在终端控制台中看到的那样,useref任务运行正常,但由于某种原因,dest目录中没有结果文件

For me this was all rev issues. 对我来说,所有都是转速问题。 Remove all local versions and -g versions of gulp-useref and make sure your local package.json devDependencies sections is list gulp-useref^3.0.0 删除gulp-useref的所有本地版本和-g版本,并确保您的本地package.json devDependencies部分是列表gulp-useref ^ 3.0.0

  "devDependencies": {
      "gulp-useref": "^3.0.0",
      .  .  .  .  
  }

then from project home npm up --dev 然后从项目主页npm up --dev

I also updated gulp-cli and gulp to 4.0 while I was at it. 在此期间,我还将gulp-cli和gulp更新为4.0。 I am a newbee so how will I every know if this is a mistake or not. 我是一个新手,所以我怎么会知道这是不是一个错误。

takes a while but it ended a day of fruitless head pounding with a satisfying result and bowl of Ben&Jerry's ice cream 花费了一段时间,但结束了无结果的头部重击的一天,结果令人满意,并享用了本杰里的冰淇淋

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM