使用gulp-angular-templatecache创建一个组合HTML模板文件时,输出文件夹无效
Getting Error: Invalid output folder when using gulp-angular-templatecache to create a combined HTML template file
我在构建过程中使用Gulp。它需要完成的主要任务之一是将所有模块文件夹中的所有.html
模板部分组合到一个.js
templateCache文件中。这为所有HTML
文件的用户创建了一次下载。
gulp-angular-templatecache
当前Gulp要求和配置设置:
var gulp = require('gulp'),
gutil = require('gulp-util'),
gulpif = require('gulp-if'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
sass = require('gulp-ruby-sass'),
streamqueue = require('streamqueue'),
sourcemaps = require('gulp-sourcemaps'),
templateCache = require('gulp-angular-templatecache'),
runSequence = require('run-sequence'),
del = require('del'),
es = require('event-stream');
var config = {
srcPartials:[
'app/beta/*',
'app/header/**/*',
'app/help/*',
'app/login/*',
'app/notificaitons/*',
'app/panels/**/*',
'app/popovers/**/*',
'app/popovers/*',
'app/user/*',
'app/dashboard.html'
],
destPartials: [
'app/templates/'
]
};
html-templates
Gulp任务:
/** HTML Template caching */
/** ------------------------------------------------------------------------- */
gulp.task('html-templates', function() {
return gulp.src(config.srcPartials)
.pipe(templateCache())
.pipe(gulp.dest(config.destPartials));
});
^所以正如你上面看到的,我的目标是从srcPartials
中列出的所有文件夹中取出所有的。html文件,并在它们上运行templateCache
,并导出到destPartials
中的dest。
但是目前得到这个错误:
错误:无效的输出文件夹在Gulp.dest
起初我认为这个任务不会自动创建文件夹,所以我继续创建app/templates
文件夹,但仍然得到这个错误:(任何想法?
我无意中发现了答案:输出文件夹是字符串,而不是数组。
https://github.com/gulpjs/gulp/issues/496~ @stevelacy
相关文章:
- 如何使用JavaScript粘贴原始二进制文件而不出现“无效字符”错误
- 数组在手动写入时有效,但从文本文件加载时无效
- 在Rails中使用remote:true在Chrome中有效,但在Safari中无效——从js.erb文件调用succe
- js.erb文件中提供给RegExp构造函数的标志无效
- Apache poi XSSF创建Excel文件-Create返回格式或文件扩展名无效的空文件
- 异步HTTP(ajax)请求在脚本标记中有效,但在js文件中无效
- 当SVG是单独的文件时,剪辑路径/web工具包掩码有效,但在内联时无效
- Jquery文件大小验证无效
- 无效文件的 Blueimp 文件上传错误消息
- 包括来自外部文件的jQuery,有些函数有效,有些则无效
- 如何删除在 Ajax文件上传上出现无效格式的默认警报
- 我不断得到空白值和无效文件
- 将包含内容和元数据的文件上传到谷歌文档会返回400无效/错误请求
- document.write在appendChild添加的Javascript文件中无效
- HTML5异步文件上传,上传的流总是无效的
- 内联javascript有效,但外部文件无效
- 脚本在html中有效,但在javascript文件中无效
- 使用jQuery表单插件上传文件-无效文件错误
- AJAX为HTML表单调用PHP文件无效
- 通过JavaScript上传文件:服务器上的文件无效