• <tfoot id='rgubv'></tfoot>

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

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

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

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

        这段将多个js文件合二为一的代码有什么问题?

        时间:2023-05-29
        <tfoot id='UjX6w'></tfoot>

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

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

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

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

                  本文介绍了这段将多个js文件合二为一的代码有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有这个 node.js 代码,它试图将多个 js 文件缩小并合并到一个 js 文件中.

                  I have this node.js code that tries to minify and combine multiple js files to a single js file.

                  var concat = require('gulp-concat');
                  var gulp = require('gulp');
                  
                  gulp.task('scripts', function() {
                      //gulp.src(['./lib/file3.js', './lib/file1.js', './lib/file2.js'])
                      gulp.src(['./js/*.js'])
                          .pipe(concat('all.js'))
                          .pipe(uglify())
                          .pipe(gulp.dest('./dist/'))
                  });
                  

                  我所有的 js 文件都位于 js 文件夹中.我的 node.js 文件位于 js 文件夹上方.我期望单个缩小文件出现在 dist 文件夹中.运行代码时,我什么也看不到,也没有收到任何错误消息.可能出了什么问题?

                  All my js files are located in js folder. My node.js file is above the js folder. I am expecting the single minified file to appear in dist folder. I see nothing and get no error message when I run the code. What could have gone wrong?

                  推荐答案

                  Gulpfile.js:

                  "use strict";
                  
                  var concat = require('gulp-concat');
                  var gulp = require('gulp');
                  var uglify = require('gulp-uglify'); // Add gulp-uglify module to your script
                  
                  gulp.task('scripts', function() {
                      gulp.src('./js/*.js')
                          .pipe(concat('all.js'))
                          .pipe(uglify())
                          .pipe(gulp.dest('./dist/'));
                  });
                  

                  检查 package.json 依赖项

                  运行 npm install 以验证是否正确加载了所有依赖项.我认为这是您的问题:

                  Check package.json dependencies

                  Run npm install to verify that all dependencies correctly loaded. I think this was your issue:

                  {
                      "dependencies": {
                          "gulp-concat": "2.x",
                          "gulp": "3.x",
                          "gulp-uglify": "1.x"
                      }
                  }
                  

                  这篇关于这段将多个js文件合二为一的代码有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:gulp:如何在不刷新的情况下更新浏览器(仅适用于 下一篇:每次在命令行中运行 gulp 时出现断言错误

                  相关文章

                  最新文章

                  • <bdo id='cEdsA'></bdo><ul id='cEdsA'></ul>
                  <legend id='cEdsA'><style id='cEdsA'><dir id='cEdsA'><q id='cEdsA'></q></dir></style></legend>
                1. <small id='cEdsA'></small><noframes id='cEdsA'>

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