Gulp-sourcemaps not creating a sourcemap file?(Gulp-sourcemaps 没有创建源映射文件?)
问题描述
我正在尝试让 Gulp 源映射来写入文件,但我无法在任何地方看到这些文件.如果在工作树中创建了任何新文件,我会在 git status
中看到它们,但没有找到任何新文件.
I'm trying to get Gulp sourcemaps to write files, but I can't see these files anywhere. If any new files were created in the working tree, I would see them in git status
, but nothing no new files to be found.
下面是我的 gulpfile.js
Below is my gulpfile.js
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
minify = require('gulp-minify'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify');
gulp.task('js', function() {
return gulp.src('src/js/**/*.js')
.pipe(sourcemaps.init())
.pipe(concat('all.js'))
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('./public/js'));
});
这是正确的用法吗?从我在其他地方看到的例子来看,这应该没问题.我还看到这些插件与源地图兼容:https://github.com/floridoo/gulp-sourcemaps/wiki/Plugins-with-gulp-sourcemaps-support
Is this correct usage? From the examples I've seen elsewhere, this should be OK. I also see that these plugins are compatable with sourcemaps: https://github.com/floridoo/gulp-sourcemaps/wiki/Plugins-with-gulp-sourcemaps-support
推荐答案
使用 sourcemaps.write()
方法,将源映射行附加到 all.js代码>文件.如果要编写外部源映射文件,则需要将路径传递给
sourcemaps.write()
方法:
Using the sourcemaps.write()
method the way you do appends a source maps line to the all.js
file. If you want to write external source map files, you'll need to pass the path to the sourcemaps.write()
method:
sourcemaps.write('../maps')
https://www.npmjs.com/package/gulp-sourcemaps
这篇关于Gulp-sourcemaps 没有创建源映射文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Gulp-sourcemaps 没有创建源映射文件?
基础教程推荐
- 响应更改 div 大小保持纵横比 2022-01-01
- 悬停时滑动输入并停留几秒钟 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- 动态更新多个选择框 2022-01-01
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 在for循环中使用setTimeout 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 我什么时候应该在导入时使用方括号 2022-01-01