我使用jhipster构建一个应用程序,这是一个使用cassandra db的微服务网关,并使用maven构建,在scaffold.i运行gulp命令之后构建正常用于ui的实时重新加载.
我在导航栏和主页上做了一个变化.这也是工作文件,并在家庭和导航栏的json文件中做了一些更改,并在添加搜索框和其他时做了一些小的更改.
它无法重新加载.我停下了gulp&maven并重新启动它们.maven正在构建但是再次没有在localhost中加载该站点
当我跑了一口气时,它向我显示了这个错误.
gulp
fs.js:952
return binding.readdir(pathModule._makeLong(path), options.encoding);
^
Error: ENOENT: no such file or directory, scandir '/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.readdirSync (fs.js:952:18)
at Object.getInstalledBinaries (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/extensions.js:121:13)
at foundBinariesList (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/errors.js:45:5)
at module.exports (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/binding.js:15:30)
at Object.<anonymous> (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
Run Code Online (Sandbox Code Playgroud)
谁能告诉我这方面的解决方案
他们之间的区别是什么?
gulp.src(imgSrc)
.pipe(newer(imgDest))
.pipe(imagemin())
.pipe(gulp.dest(imgDest));
Run Code Online (Sandbox Code Playgroud)
gulp.src(SRC)
.pipe(changed(DEST))
// ngmin will only get the files that
// changed since the last time it was run
.pipe(ngmin())
.pipe(gulp.dest(DEST));
Run Code Online (Sandbox Code Playgroud)
看来gulp-change更强大,因为它提供了一个选项
hasChanged: changed.compareLastModifiedTime
Run Code Online (Sandbox Code Playgroud) 我想从gulp运行一个shell命令,使用gulp-shell.我看到以下习惯用于gulpfile.
这是从gulp任务运行命令的惯用方法吗?
var cmd = 'ls';
gulp.src('', {read: false})
.pipe(shell(cmd, {quiet: true}))
.on('error', function (err) {
gutil.log(err);
});
Run Code Online (Sandbox Code Playgroud) 我正在使用gulp.
我想有一个或多个JS文件(比如说jQuery)将它们组合在一起,缩小它,然后将它写入分发文件夹.
我是这样做的:
minifyJS(['/js/myModule.file1.js',
'/js/myModule.file2.js'], '/dist/js', 'myModule')
Run Code Online (Sandbox Code Playgroud)
功能:
function minifyJS(sourceFiles, destinationFolder, filenameRoot) {
return gulp.src(sourceFiles)
.pipe(plumber())
// .pipe(sourcemaps.init()) here ???
.pipe(concat(filenameRoot + '.js'))
.pipe(sourcemaps.init()) // or here ???
.pipe(gulp.dest(destinationFolder)) // save .js
.pipe(uglify({ preserveComments: 'license' }))
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(destinationFolder)) // save .min.js
.pipe(sourcemaps.write('maps'))
.pipe(gulp.dest(destinationFolder)) // save .map
}
Run Code Online (Sandbox Code Playgroud)
我不确定的是sourcemaps.init()位置......
我应该创建多个(在我的情况下是2个)地图文件(如果浏览器支持那么会很好)或只创建一个(/maps/myModule.map)?
我在Angular2项目中使用SystemJS.我为TypeScript使用tsconfig文件.我想使用gulp来连接和缩小我的生产版代码.我在解决代码方面遇到了问题:每次尝试连接文件时都会得到"angular"未定义或"system"未定义.我试图修改我尝试从节点模块加载文件的顺序,但是我没有成功.
我想知道你们是否有这个问题,并找到答案吗?
这是我的gulp文件:
var gulp = require('gulp'),
.....
var paths = {
dist: 'dist',
vendor: {
js: [
'node_modules/systemjs/dist/system.src.js',
'node_modules/angular2/bundles/angular2.dev.js',
'node_modules/angular2/bundles/angular2-polyfills.js',
'node_modules/angular2/bundles/router.dev.js'
...
],
css: []
},
app: {
templates: [
'app/**/*.html',
'!node_modules/*.html'
],
scripts: [
'app/**/*.ts',
'app/config.ts',
'app/app.ts'
]
}
};
var tsProject = ts.createProject('tsconfig.json', {
out: 'Whatever.js'
});
gulp.task('dev:build:templates', function () {
return gulp.src(paths.app.templates)
.pipe(ngHtml2Js({
moduleName: 'Whatever',
declareModule: false
}))
.pipe(concat("Whatever.tpls.min.js"))
.pipe(gulp.dest(paths.dist));
});
gulp.task('prod:build:templates', function () {
return gulp.src(paths.app.templates)
.pipe(minifyHtml({
empty: true,
spare: true,
quotes: true
}))
.pipe(ngHtml2Js({ …Run Code Online (Sandbox Code Playgroud) 我正在尝试缩小我的脚本文件,我正在使用gulp任务运行器而我正在尝试gulp-uglify插件
码:
gulp.task('concat', function() {
return gulp.src('app/**/*.js')
// .pipe(concat('script.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist/'))
});
Run Code Online (Sandbox Code Playgroud)
但我得到的错误是
当我尝试运行gulp任务作为gulp concat任何帮助将不胜感激
我真的很喜欢gulpjs这是我的首选任务经理,但我希望我能在几个月前了解任务经理并进入gruntjs,主要是为了获得支持.对于gulpjs来说,很难找到有关具体事物的信息.
我的问题是我如何设置我,gulpfile.js以便我可以编辑bootstrap.less文件variables.less.我确实安装了" gulp-less ",并在下面实现了它.
var less = require('gulp-less'),
path = require('path');
gulp.task('less', function () {
gulp.src('./source/less/variables.less')
.pipe(less())
.pipe(gulp.dest('./source/css/bootstrap.css'));
});
Run Code Online (Sandbox Code Playgroud)
运行后我收到以下错误gulp less.
events.js:72
throw er; // Unhandled 'error' event
^
Error: EEXIST, mkdir 'C:\wamp\www\myproj\source\css\bootstrap.css'
我不认为我的sass任务代码设置正确,我是一个gulp noobie但我尝试了多种组合,是的我确实使用了" gulp-less "文档中的示例,我使用的代码是最简洁明了的切断我想要完成的代码.
编辑:我在谷歌上发现了一些好的关键词我发现了一些关于这个的最近帖子,这里是一个开始Gulp与Gulp-less维护文件夹结构似乎没有一个好的答案生病必须阅读.
附加:我忘记了使用文档中的代码时,我收到了alert.less的错误
gulp.task('less', function () {
gulp.src('./source/less/*.less')
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(gulp.dest('./source/css'));
});
Run Code Online (Sandbox Code Playgroud)
错误
stream.js:94
throw er; // Unhandled stream error in pipe.
^
[gulp] Error in plugin 'gulp-less': …
在gulp页面上有以下示例:
gulp.task('clean', function(cb) {
// You can use multiple globbing patterns as you would with `gulp.src`
del(['build'], cb);
});
gulp.task('scripts', ['clean'], function() {
// Minify and copy all JavaScript (except vendor scripts)
return gulp.src(paths.scripts)
.pipe(coffee())
.pipe(uglify())
.pipe(concat('all.min.js'))
.pipe(gulp.dest('build/js'));
});
// Copy all static images
gulp.task('images', ['clean'], function() {
return gulp.src(paths.images)
// Pass in options to the task
.pipe(imagemin({optimizationLevel: 5}))
.pipe(gulp.dest('build/img'));
});
// the task when a file changes
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.images, ['images']);
});
// The …Run Code Online (Sandbox Code Playgroud) 我一直在使用gulp-watch.当前版本的gulp-watch依赖于调用gulp.parrallel.此通话仅适用于gulp 4.
但是通过npm repo无法获得gulp 4.
npm info gulp dist-tags回报:{ latest: '3.9.0' }.
我可以看到git repo中有一个4.0分支.但尝试使用此命令的变体安装它失败:npm install https://github.com/gulpjs/gulp#v4.0.0.
gulp ×10
javascript ×6
npm ×2
angular ×1
cassandra ×1
gulp-less ×1
gulp-uglify ×1
gulp-watch ×1
jhipster ×1
mapping ×1
maven ×1
systemjs ×1
typescript ×1