update gulpfile for gulp 4

This commit is contained in:
David Miller 2018-12-22 21:53:41 -07:00
parent 7c9f4add33
commit 829a3319d4
10 changed files with 977 additions and 639 deletions

View File

@ -1,5 +1,6 @@
sudo: false
language: node_js
git:
depth: 3
node_js:
- "node"
install: npm install
@ -9,3 +10,5 @@ script:
cache:
directories:
- node_modules
notifications:
email: false

View File

@ -1,5 +1,5 @@
/*!
* Start Bootstrap - Agency v5.0.3 (https://startbootstrap.com/template-overviews/agency)
* Start Bootstrap - Agency v5.0.4 (https://startbootstrap.com/template-overviews/agency)
* Copyright 2013-2018 Start Bootstrap
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-agency/blob/master/LICENSE)
*/

2
css/agency.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,17 @@
var gulp = require('gulp');
var sass = require('gulp-sass');
var header = require('gulp-header');
var cleanCSS = require('gulp-clean-css');
var rename = require("gulp-rename");
var uglify = require('gulp-uglify');
var autoprefixer = require('gulp-autoprefixer');
var pkg = require('./package.json');
var browserSync = require('browser-sync').create();
// Load plugins
const autoprefixer = require("gulp-autoprefixer");
const browsersync = require("browser-sync").create();
const cleanCSS = require("gulp-clean-css");
const gulp = require("gulp");
const header = require("gulp-header");
const plumber = require("gulp-plumber");
const rename = require("gulp-rename");
const sass = require("gulp-sass");
const uglify = require("gulp-uglify");
const pkg = require('./package.json');
// Set the banner content
var banner = ['/*!\n',
const banner = ['/*!\n',
' * Start Bootstrap - <%= pkg.title %> v<%= pkg.version %> (<%= pkg.homepage %>)\n',
' * Copyright 2013-' + (new Date()).getFullYear(), ' <%= pkg.author %>\n',
' * Licensed under <%= pkg.license %> (https://github.com/BlackrockDigital/<%= pkg.name %>/blob/master/LICENSE)\n',
@ -18,7 +20,7 @@ var banner = ['/*!\n',
].join('');
// Copy third party libraries from /node_modules into /vendor
gulp.task('vendor', function() {
gulp.task('vendor', function(cb) {
// Bootstrap
gulp.src([
@ -47,14 +49,19 @@ gulp.task('vendor', function() {
])
.pipe(gulp.dest('./vendor/jquery-easing'))
cb();
});
// Compile SCSS
gulp.task('css:compile', function() {
return gulp.src('./scss/**/*.scss')
.pipe(sass.sync({
outputStyle: 'expanded'
}).on('error', sass.logError))
// CSS task
function css() {
return gulp
.src("./scss/*.scss")
.pipe(plumber())
.pipe(sass({
outputStyle: "expanded"
}))
.on("error", sass.logError)
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
@ -62,61 +69,63 @@ gulp.task('css:compile', function() {
.pipe(header(banner, {
pkg: pkg
}))
.pipe(gulp.dest('./css'))
});
// Minify CSS
gulp.task('css:minify', ['css:compile'], function() {
return gulp.src([
'./css/*.css',
'!./css/*.min.css'
])
.pipe(cleanCSS())
.pipe(gulp.dest("./css"))
.pipe(rename({
suffix: '.min'
suffix: ".min"
}))
.pipe(gulp.dest('./css'))
.pipe(browserSync.stream());
});
.pipe(cleanCSS())
.pipe(gulp.dest("./css"))
.pipe(browsersync.stream());
}
// CSS
gulp.task('css', ['css:compile', 'css:minify']);
// Minify JavaScript
gulp.task('js:minify', function() {
return gulp.src([
// JS task
function js() {
return gulp
.src([
'./js/*.js',
'!./js/*.min.js'
'!./js/*.min.js',
'!./js/contact_me.js',
'!./js/jqBootstrapValidation.js'
])
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(header(banner, {
pkg: pkg
}))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./js'))
.pipe(browserSync.stream());
});
.pipe(browsersync.stream());
}
// JS
gulp.task('js', ['js:minify']);
// Tasks
gulp.task("css", css);
gulp.task("js", js);
// Default task
gulp.task('default', ['css', 'js', 'vendor']);
// Configure the browserSync task
gulp.task('browserSync', function() {
browserSync.init({
// BrowserSync
function browserSync(done) {
browsersync.init({
server: {
baseDir: "./"
}
});
});
done();
}
// Dev task
gulp.task('dev', ['css', 'js', 'browserSync'], function() {
gulp.watch('./scss/*.scss', ['css']);
gulp.watch('./js/*.js', ['js']);
gulp.watch('./*.html', browserSync.reload);
});
// BrowserSync Reload
function browserSyncReload(done) {
browsersync.reload();
done();
}
// Watch files
function watchFiles() {
gulp.watch("./scss/**/*", css);
gulp.watch(["./js/**/*.js", "!./js/*.min.js"], js);
gulp.watch("./**/*.html", browserSyncReload);
}
gulp.task("default", gulp.parallel('vendor', css, js));
// dev task
gulp.task("dev", gulp.parallel(watchFiles, browserSync));

2
js/agency.min.js vendored
View File

@ -1,5 +1,5 @@
/*!
* Start Bootstrap - Agency v5.0.3 (https://startbootstrap.com/template-overviews/agency)
* Start Bootstrap - Agency v5.0.4 (https://startbootstrap.com/template-overviews/agency)
* Copyright 2013-2018 Start Bootstrap
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-agency/blob/master/LICENSE)
*/

View File

@ -1,7 +0,0 @@
/*!
* Start Bootstrap - Agency v5.0.3 (https://startbootstrap.com/template-overviews/agency)
* Copyright 2013-2018 Start Bootstrap
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-agency/blob/master/LICENSE)
*/
$(function(){$("#contactForm input,#contactForm textarea").jqBootstrapValidation({preventSubmit:!0,submitError:function(t,e,s){},submitSuccess:function(t,e){e.preventDefault();var s=$("input#name").val(),a=$("input#email").val(),n=$("input#phone").val(),c=$("textarea#message").val(),i=s;0<=i.indexOf(" ")&&(i=s.split(" ").slice(0,-1).join(" ")),$this=$("#sendMessageButton"),$this.prop("disabled",!0),$.ajax({url:"././mail/contact_me.php",type:"POST",data:{name:s,phone:n,email:a,message:c},cache:!1,success:function(){$("#success").html("<div class='alert alert-success'>"),$("#success > .alert-success").html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;").append("</button>"),$("#success > .alert-success").append("<strong>Your message has been sent. </strong>"),$("#success > .alert-success").append("</div>"),$("#contactForm").trigger("reset")},error:function(){$("#success").html("<div class='alert alert-danger'>"),$("#success > .alert-danger").html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;").append("</button>"),$("#success > .alert-danger").append($("<strong>").text("Sorry "+i+", it seems that my mail server is not responding. Please try again later!")),$("#success > .alert-danger").append("</div>"),$("#contactForm").trigger("reset")},complete:function(){setTimeout(function(){$this.prop("disabled",!1)},1e3)}})},filter:function(){return $(this).is(":visible")}}),$('a[data-toggle="tab"]').click(function(t){t.preventDefault(),$(this).tab("show")})}),$("#name").focus(function(){$("#success").html("")});

File diff suppressed because one or more lines are too long

1456
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"title": "Agency",
"name": "startbootstrap-agency",
"version": "5.0.3",
"version": "5.0.4",
"description": "Agency is a one page HTML theme for Bootstrap.",
"keywords": [
"css",
@ -33,10 +33,11 @@
},
"devDependencies": {
"browser-sync": "2.26.3",
"gulp": "^3.9.1",
"gulp": "4.0.0",
"gulp-autoprefixer": "6.0.0",
"gulp-clean-css": "4.0.0",
"gulp-header": "2.0.7",
"gulp-plumber": "^1.2.1",
"gulp-rename": "1.4.0",
"gulp-sass": "4.0.2",
"gulp-uglify": "3.0.1"

View File

@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248c18.6 0 36.7-2.1 54.1-5.9-5.6-7.4-10.8-14.4-15.9-21.3-12.4 2.1-25.2 3.3-38.3 3.3C124.3 480 24 379.7 24 256S124.3 32 248 32s224 100.3 224 224c0 71-33 134.2-84.5 175.3-25.9 18.8-39.1 21.4-83.5-44.2-78.7-112.9-48-71.1-73.7-108.3 72.8 8.9 228.5-72 168.6-168.6C314-26.8 15 93.8 59.7 226.4c3.2 9.8 14.4 38.6 45.6 38.6 2 0 2.6-.6 2-1.7-4.4-8.7-20.1-9.8-20.1-37.4 0-40.5 40.5-89.6 100.3-120 66.1-32.3 131.9-30.2 158.2 5.4 27.2 38.3-20.9 119.2-120.4 136.9 7.5-9.4 57-75.2 62.8-84 22.7-34.6 23.6-49 14-59.2-15.5-16.9-29.5-10.3-50.7-11.7-10.8-.9-113.7 181.2-136.4 216.9-5.9 9-21.2 34.1-21.2 50.9 0 21.3 2.8 51.4 20.6 51.4 10.6 0 8-18.7 8-26.6 0-12.9 27.4-49.4 74.8-104.6 20.4 36.1 57.7 114.3 130.2 209.7 98-33.1 168.5-125.8 168.5-235C496 119 385 8 248 8z"/></svg>
<!--
Font Awesome Free 5.3.1 by @fontawesome - https://fontawesome.com
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
-->

Before

Width:  |  Height:  |  Size: 1.0 KiB