草庐IT

gulp-rev

全部标签

javascript - Gulp-sourcemaps 没有创建 sourcemap 文件?

我试图让Gulpsourcemaps写入文件,但我无法在任何地方看到这些文件。如果在工作树中创建了任何新文件,我会在gitstatus中看到它们,但找不到任何新文件。下面是我的gulpfile.jsvargulp=require('gulp'),sourcemaps=require('gulp-sourcemaps'),minify=require('gulp-minify'),concat=require('gulp-concat'),uglify=require('gulp-uglify');gulp.task('js',function(){returngulp.src('src

javascript - 从单独的 gulp 文件导入/读取变量

我希望将我的gulpfile.jsassets或src变量拆分到单独的文件中,以便我可以更好地管理它们。例如:....varscripts=['awful.js','lot.js','of.js','js.js','files.js']....(somewheredowntheline)gulp.task('vendorjs',function(){returngulp.src(scripts).pipe(concat('vendor.js')).pipe(rename({suffix:'.min'})).pipe(uglify()).pipe(gulp.dest(paths.root

javascript - 通过 gulp 从 index.html 中删除脚本

我在我们的应用程序中使用gulp,我们在Gulpfile.js中有2个流程,一个用于生产,第二个用于开发,但我不想保留2个index.html文件,例如index.html和index.dev。html,我想要一个index.html文件,但是对于生产构建,我有一些不需要的脚本,例如.问题是:如何通过Gulp从html中删除某些内容? 最佳答案 您可以使用专用于此特定目的的gulp-html-replace插件:https://www.npmjs.org/package/gulp-html-replace

javascript - Gulp:如何按顺序组合任务?

我需要通过顺序处理不同的源来组合gulp任务,因为它们之间存在依赖关系。根据文档,这应该完成我的合并流,但我看不到如何强制对它们进行排序和序列化。在Gulp3中建模的正确方法是什么?我通常使用函数作为各个构建步骤的容器,然后从构建和监视任务中调用它们:functionbuildModule(module){varstreams=[];//steponestreams.push(gulp.src(path.join('./modules',module,'*.js'))//...seriesofchainedcalls);//steptwostreams.push(gulp.src([T

javascript - 使用 gulp 进行丑化时,Angular-ui-router 会中断

我有以下简单的angular.js应用程序,遵循概述的最佳实践here.angular.module('myApp',['ui.router']);(function(){functionroutes($stateProvider,$urlRouterProvider){$urlRouterProvider.otherwise("/404");$stateProvider.state('createCluster',{url:'/create-cluster',templateUrl:'templates/create-cluster.html'})}angular.module('m

javascript - 我用 gulp 收到 Malloc 错误

有趣的是我是如何使用gulp得到内存分配错误的,不管错误的输出是什么:gulpcompile:development[15:33:51]Warning:gulpversionmismatch:[15:33:51]Globalgulpis3.8.7[15:33:51]Localgulpis3.8.6[15:33:52]Usinggulpfile~/Dropbox/AisisGit/Zen/gulpfile.js[15:33:52]Starting'bower'...[15:33:52]Usingcwd:./[15:33:52]Usingbowerdir:./bower_component

javascript - Gulp 监视任务不会在 Ctrl C 上退出

背景我有这个gulpwatch任务来处理sass编译:importgulpfrom'gulp';importsassfrom'gulp-sass';importconcatfrom'gulp-concat';gulp.task("compile-scss",()=>{returngulp.src("assets/scss/**/*.scss").pipe(sass({outputStyle:'compressed'}).on("error",sass.logError)).pipe(concat("style.css")).pipe(gulp.dest("dist/css"));});

javascript - gulp 是否对 javascript 文件进行代码拆分?

我正在使用gulp,我想知道它是否具有代码拆分功能。类似于webpacksite中提到的内容.我在网上看过,但没有看到任何专门用于此的内容。 最佳答案 我在网上找到这个gulp-split-files,我希望这能解决您的问题。正如作者在文档中所说的那样。在你的gulpfile中:constgulp=require("gulp");constsplitFiles=require("gulp-split-files");gulp.task("split",function(){returngulp.src("superMegaBigCs

javascript - Gulp Connect 未运行服务器

我创建了gulpfile.js并在其中使用了gulp-connectgulp.task('connect',function(){connect.server({root:'dev',livereload:true,port:8000});})当我运行gulpconnect时,它不会在localhost:8000上维护我的服务器。[14:08:51]Starting'connect'...[14:08:51]Serverstartedhttp://localhost:8000[14:08:51]LiveReloadstartedonport35729[14:08:51]Finished

javascript - gulp-useref – 不同级别文件夹中的相对输出路径

目前有没有办法做相对输出路径?内gulp-useref还是其他?我的现状:project_folder/app/index.htmlabout/index.htmlscripts/index.jsabout.js在index.html基于app/,一切正常:index.html文件位于scripts旁边文件夹,以便相对路径正确同步。但这是about/index.html:如果我像这样传递路径–../scripts/about.min.js–生成的about.min.js获取输出太远的一个文件夹,导致这种情况:project_folder/scripts/about.min.jsdist