gulp-browserify-starter-faq
全部标签 我正在尝试找出一种简单的方法来在脚本中需要一个html模板,然后从CLI运行browserify。假设我想抓取一个模板并将其附加到正文。//index.jsvartemplate=require('./template.html');document.body.appendChild(template);和Woooo!然后使用CLI将其全部包装在Browserify中。浏览器化index.js>build.js在浏览器中加载引用build.js的index.html模板时,我在控制台中收到此错误:UncaughtSyntaxError:Unexpectedtoken引用....},{}
我正在从Gulp3升级到4,但我遇到了一个错误:Thefollowingtasksdidnotcomplete:buildDidyouforgettosignalasynccompletion?我明白它在说什么,但不明白为什么这段代码会触发它。无论是否出错,任务完成(文件被连接并写入目标)。在没有lazypipe的情况下执行相同的代码不会导致错误,并且在lazypipe中删除连接也可以修复错误。将整个东西包装在创建流的东西中(比如合并流)可以解决这个问题。我猜gulp-concat和lazypipe之间的交互阻止了正确返回流。这是(简化的)任务:gulp.task('build',fu
您好,我正在使用gruntbrowserify任务来设置我的代码,我已经在jQuery中填充,现在我正在尝试包含jquery.tablesorter。jquery插件可以通过这种方式与browserify一起使用吗?shim:{jquery:{path:'lib/bower/jquery/jquery.js',exports:'$'},'jquery.tablesorter':{path:'lib/bower/jquery.tablesorter/js/jquery.tablesorter.js',exports:'tablesorter',depends:{jquery:'$',}}
我有这个基本设置来构建我的Angular模板。这是gulpfilevargulp=require("gulp"),templateCache=require('gulp-angular-templatecache');gulp.task("tc",function(){returngulp.src("test.html").pipe(templateCache())//whenIcommentoutthislineIseetest.htmlfileisgettingcopiedunderdestfolder.pipe(gulp.dest("dest"));});这是一个简单的html文
我正在尝试编写一个gulp任务,通过gulp-promptplugin接收一些用户输入.但我无法将该输入传递给其他人,例如:gulp.task('userinput',function(){varmyVar='MONKEY';gulp.src('./templates/_component.*').pipe(prompt.prompt([{type:'input',name:'userInput',message:'Saysomething'}],function(res){myVar=res.userInput;})).pipe(prompt.confirm('Yousaid'+my
我看到的所有使用browserify和gulp的例子都假设你只想浏览1个文件。通常情况并非如此。我遇到了一个使用vinyl-transforms的例子,但我无法让它正常工作。这是(CoffeeScript)代码:#BrowserifyJSgulp.task'browserify',[],->#Createthetransformbr=transform(f)->returnbrowserify(f).bundle()#Runbrowserifygulp.src(['./public/js/**/*.js']).pipe(br).pipe(gulp.dest('.'))但是我得到以下错误
我在使用gulp时遇到问题。我运行gulp-watch以及gulp-less和gulp-clean。一切都在完美运行。当我编辑somefile.less并在缺少分号的情况下保存它或者我可能不小心留下了尾随;s时,我的代码中只有错误保存,gulp-less在控制台中记录错误。在我修复它之后gulp-watch继续观察文件,但是gulp-less没有触发也没有编译。当我停止gulp并在终端中再次运行它时,一切都会恢复正常。这是我的gulpfile.js:vargulp=require('gulp');varclean=require('gulp-clean');vargutil=requi
使用基本的gulp/expressbuildwatch出现奇怪的错误。目录布局project/-sass/-style.scss-gulpfile.js-index.htmlGulpfile.jsvargulp=require('gulp'),sass=require('gulp-ruby-sass'),autoprefixer=require('gulp-autoprefixer'),minifycss=require('gulp-minify-css'),rename=require('gulp-rename');gulp.task('express',function(){var
我正在尝试连接gulp-browserify和gulp-watch每次源文件更改时重建我的包。但是,gulp-browserify需要一个单一的编译入口点(例如src/js/app.js)并获取每个依赖项本身:gulp.src('src/js/app.js').pipe(browserify()).pipe(gulp.dest('dist'))但是,使用gulp-watch这无法在每次更改时重建,因为只监视入口点文件。我真正需要的是可以监视多个文件,然后只处理入口点文件(查找replaceEverythingWithEntryPointFile):gulp.src("src/**/*.
我目前有这个factor-bundle命令,我用它来捆绑我的文件,并将所有通用的东西拉到一个通用文件中:browserifyindex.jsbar-charts.jslist-filter.jsdashboard.js-p[factor-bundle-o../../static/js/index.js-o../../static/js/bar-chart.js-o../../static/js/list-filter.js-o../../static/js/dashboard.js]-o../../static/js/common.js我以前也用这个命令来丑化单个文件:browseri