Answer the question
In order to leave comments, you need to log in
Why is Gulp.js replacing a while loop with a for?
I did not find anything in the settings that clearly indicates such changes in the code. Google didn't help much either.
gulpfile.js
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
minifyCSS = require('gulp-minify-css'),
sourcemaps = require('gulp-sourcemaps'),
sass = require('gulp-sass'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat');
// css
gulp.task('css', function () {
return gulp.src('scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 100 versions','ie > 8', 'opera > 12.1', 'Safari > 5', 'ff > 5']
}))
.pipe(minifyCSS())
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest('../css/'));
});
// js
gulp.task('js', function () {
gulp.src([
'js/lang.js',
'js/jquery.js',
'js/lib/jquery.validate.js',
'js/lib/masonry.js',
'js/lib/moment.js',
'js/lib/daterangepicker.js',
'js/lib/slick.js',
'js/lib/ion.rangeSlider.min.js',
'js/lib/lli.js',
'js/lib/simpleCalendar.js',
'js/lib/jquery.Photostack.js',
'js/scripts/*.js'
])
.pipe(uglify())
.pipe(concat('app.js'))
.pipe(gulp.dest('../js/'));
});
// watcher
gulp.task('watch', function () {
gulp.watch('scss/*.scss', ['css'])
gulp.watch('js/**/*.js', ['js'])
});
// deafault
gulp.task('default', ['css', 'js', 'watch']);
var day = 1;
var dayCount = monthData.monthDaysCount();
var self = this;
while (day < dayCount) {
//
}
for (var n = 1, r = t.monthDaysCount(), a = this; n < r; ) {
//
}
Answer the question
In order to leave comments, you need to log in
Both options are equivalent. What is the problem?
Read: gulp-uglify compression options
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question