Answer the question
In order to leave comments, you need to log in
How to include *.JS in the new edition of OptimizedHTML 5??
Kind!
Question for people who use the OptimizedHTML /v.2/v.3/v.4/v.5
build versions in their structure are quite different from version to version ..
To tell the truth, I had to "jump" from OptimizedHTML 2.0 immediately to 5th .. I had to reconnect everything .. ((
I already figured out how to connect in a new way: fonts/$ colors/bootstrup - there is _config.sass for this (so far it's logical here) But I can't figure out how to include libraries now (JS - various plugins) and most importantly
of
course common.js ???
// Custom project scripts
gulp.task('common-js', function() {
return gulp.src([
'app/js/common.js',
])
.pipe(concat('common.min.js'))
.pipe(uglify())
.pipe(gulp.dest('app/js'));
});
gulp.task('scripts', function() {
return gulp.src([
'./app/libs/modernizr/modernizr.js',
'./app/libs/jquery/jquery-1.11.2.min.js',
'./app/libs/waypoints/waypoints.min.js',
'./app/libs/animate/animate-css.js',
'./app/libs/Magnific-Popup/jquery.magnific-popup.min.js',
'./app/libs/animateNumber/jquery.animateNumber.min.js',
'./app/libs/equalHeights/equalHeights.min.js',
'./app/libs/owl-carousel/owl.carousel.min.js',
'./app/libs/selectize/dist/js/standalone/selectize.min.js',
'./app/libs/parallax/parallax.min.js',
'./app/libs/slider-simple/superslide.2.1.js'
])
.pipe(concat('libs.js'))
.pipe(uglify()) //Minify libs.js
.pipe(gulp.dest('./app/js/'));
});
function scripts() {
return src(paths.scripts.src)
.pipe(concat(paths.jsOutputName))
.pipe(uglify())
.pipe(dest(paths.scripts.dest))
.pipe(browserSync.stream())
}
Answer the question
In order to leave comments, you need to log in
Hmm .. In general, I don’t use this tool, but I went to the github and looked at the gulpfile and everything is clear
scripts: {
src: [
// 'node_modules/jquery/dist/jquery.min.js', // npm vendor example (npm i --save-dev jquery)
baseDir + '/js/app.js' // app.js. Always at the end
],
dest: baseDir + '/js',
}
function scripts() {
return src(paths.scripts.src)
.pipe(concat(paths.jsOutputName))
.pipe(uglify())
.pipe(dest(paths.scripts.dest))
.pipe(browserSync.stream())
}
you have to compile common.js on it and transfer it to a new computer already in a compressed form (file 'scripts.min.js')
OptimizedHTML - this is the analogue of webpack))
As for the "towel", apparently it is necessary, but I can't figure out exactly how:
there is such a construction:
let paths = {
scripts: {
src: [
// 'node_modules/jquery/dist/jquery.min.js', // npm vendor example (npm i --save-dev jquery)
baseDir + '/js/app.js' // app.js. Always at the end
],
dest: baseDir + '/js',
},
styles: {
src: baseDir + '/' + preprocessor + '/main.*',
dest: baseDir + '/css',
},
images: {
src: baseDir + '/images/src/**/*',
dest: baseDir + '/images/dest',
},
cssOutputName: 'app.min.css',
jsOutputName: 'app.min.js',
}
baseDir + '/libs/Magnific-Popup/jquery.magnific-popup.min.js',
baseDir + '/js/app.js' // app.js. Always at the end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question