-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modifies binary files #2
Comments
@cfoellmann Those should be untouched. In fact, gulp-line-ending-corrector shouldn't even have to be aware of those files. Can you post the contents of your gulpfile.js here? |
var gulp = require('gulp');
var lec = require('gulp-line-ending-corrector');
gulp.task('default', function() {});
// QA - Check for coding issues
gulp.task('qa', ['lec']);
// check encoding + line-endings
gulp.task('lec', function() {
gulp.src(['./**/*', '!node_modules/**'])
.pipe(lec({verbose: true, eolc: 'LF', encoding: 'utf8'}))
.pipe(gulp.dest('./'));
}); I fixed it with this: // low-level equipment
var gulp = require('gulp'), // gulp
isBinary = require("gulp-is-binary"), // detect if a file is a binary
through = require("through2"), // transform the stream
// QA
lec = require('gulp-line-ending-corrector'); //
gulp.task('default', function() {});
// QA - Check for coding issues
gulp.task('qa', ['lec']);
// check encoding + line-endings
gulp.task('lec', function() {
gulp.src(['./**/*', '!node_modules/**'])
.pipe(isBinary())
.pipe(through.obj(function(file, enc, next) {
if (file.isBinary()) {
next();
return;
}
next(null, file);
}))
.pipe(lec({verbose: true, eolc: 'LF', encoding: 'utf8'}))
.pipe(gulp.dest('./'));
}); |
@cfoellmann Thanks for the solution. I am going to mark this issue closed as the issue should be handled outside the plugin (like the way you did). I'll put a link to this issue in the README.md in case someone else is facing this issue. |
For those who are late, I solved the problem with much simpler solution using import lineec from 'gulp-line-ending-corrector';
import isBinary from 'gulp-is-binary';
import gulpif from 'gulp-if';
export const fixeol = () => {
gulp.src( [ './**/*', '!node_modules/**' ] )
.pipe( isBinary() )
.pipe( gulpif( file => ! file.isBinary(), lineec() ) )
.pipe( gulp.dest( './' ) );
}; |
When I run the gulp task across all files in my project git detects changes in binary files like .png or .mo files.
These should be untouched, right?
The text was updated successfully, but these errors were encountered: