草庐IT

gulp-file-include

全部标签

javascript - Nodemon 重启运行 gulp 任务

我的gulpfile中有以下代码gulp.task('scripts',function(){gulp.src(paths.browserify).pipe(browserify()).pipe(gulp.dest('./build/js')).pipe(refresh(server));});gulp.task('lint',function(){gulp.src(paths.js).pipe(jshint()).pipe(jshint.reporter(stylish));});gulp.task('nodemon',function(){nodemon({script:'app.

javascript - Gulp - 从 javascript 文件中删除注释

我正在寻找一种使用gulp从javascript文件中删除所有评论的方法。例如,我有以下代码:/****Comment1-Thisismyjavascriptheader*@desccommentheadertoberemoved*@paramsreq,res*/(function(){varhelloworld='HelloWorld';//Comment2-thisisvariable/*Comment3-thisistheprinting*/console.log(helloworld);})()我的预期结果是:(function(){varhelloworld='HelloWo

javascript - 使用 reader.readAsArrayBuffer(file) 获取图像 base64

我正在尝试获取base64字符串中的图像内容。最初我是用readAsDataURL做的但是becauseIwanttovalidatethemimetypeontheclientside,看来我必须使用readAsArrayBuffer也指出onthissite.所以我以前工作得很好:varreader=newFileReader();reader.onloadend=function(event){varbase64=reader.result;};reader.readAsDataURL(event.target.files[0]);Reproductiononline现在我添加了

javascript - 错误 : Failed to execute 'send' on 'XMLHttpRequest' : Failed to load 'file' : AngularJS SPA

我是AngularSPA的新手,这是我第一次通过谷歌搜索获得代码并尝试运行。但是我在控制台中遇到了一些错误。我不知道为什么,我发现了以下控制台错误列表:XMLHttpRequestcannotloadfile:///C:/Users/hp/Downloads/single-page-app-angularjs-master/home.html.Crossoriginrequestsareonlysupportedforprotocolschemes:http,data,chrome,chrome-extension,https,chrome-extension-resource.Err

javascript - 使用 Gulp + Browserify 时,对象 #<Readable> 没有方法 'write'

当关注examplerecipe时来自Gulp.js存储库。我得到一个错误:[12:27:31]UsinggulpfileC:\GH\riot-tag-build\Gulpfile.js[12:27:31]Starting'browserify'..._stream_readable.js:602varwritten=dest.write(chunk);^TypeError:Object#hasnomethod'write'atwrite(_stream_readable.js:602:24)atflow(_stream_readable.js:611:7)at_stream_read

javascript - 根据路线切换 ng-include 的可见性

我有以下配置:$routeProvider.when('/cars',{templateUrl:'app/cars/index.html',controller:'CarsCtrl',reloadOnSearch:false}).when('/bikes',{templateUrl:'app/bikes/index.html',controller:'BikesCtrl',reloadOnSearch:false});在我的根目录index.html的某处有一个:CarsBikes现在,我希望两个View同时在DOM中加载和生成,并根据路由/URL显示其中一个。类似下面的内容(不是实际

javascript - browserify 入门 : import local files?

我一直在制作一个JavaScript应用程序的原型(prototype),现在我想使用browserify进行更强大的设置,并使用require管理依赖项。目前我的应用程序中有以下文件:chart.jsform.jshighcharts-options.jsvendor/highcharts.jsjquery.jshighcharts-options.js基本上是一个常量列表,而chart.js看起来像这样......varmyChart={setup:function(data){...this.render(data);},render:function(data){...}},和

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