Skip to content

Commit

Permalink
Major package updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jac21 committed Sep 7, 2024
1 parent 5a443d2 commit eae5b76
Show file tree
Hide file tree
Showing 4 changed files with 2,911 additions and 4,918 deletions.
139 changes: 74 additions & 65 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,136 +1,145 @@
'use strict';
"use strict";

var gulp = require('gulp'); // gulping!
var browserSync = require('browser-sync'); // sync browser with code changes!
var lint = require('gulp-eslint'); // lint JS files!
var imagemin = require('gulp-imagemin'); // optimizing images!
var rename = require('gulp-rename'); // renaming JS!
var sourcemaps = require('gulp-sourcemaps'); // sourcemapping!
var uncss = require('gulp-uncss'); // shedding CSS!
var crass = require('gulp-crass'); // optimizing CSS!
var concat = require('gulp-concat'); // concat helper!
var historyApiFallback = require('connect-history-api-fallback'); // local development helper!
var gulp = require("gulp"); // gulping!
var browserSync = require("browser-sync"); // sync browser with code changes!
var lint = require("gulp-eslint"); // lint JS files!
const imagemin = import("gulp-imagemin"); // optimizing images!
var rename = require("gulp-rename"); // renaming JS!
var uncss = require("gulp-uncss"); // shedding CSS!
var crass = require("gulp-crass"); // optimizing CSS!
var concat = require("gulp-concat"); // concat helper!
var historyApiFallback = require("connect-history-api-fallback"); // local development helper!

// configuration object
var config = {
proxyUrl: 'http://localhost:8080',
browser: 'chrome',
proxyUrl: "http://localhost:8080",
browser: "chrome",
port: 7001,
paths: {
files: '**/*.*',
images: 'images/**/*.*',
files: "**/*.*",
images: "images/**/*.*",
applicationJavascript: [
'scripts/app.js',
'scripts/controllers/*.js',
'scripts/directives/responsiveImage.js'
"scripts/app.js",
"scripts/controllers/*.js",
"scripts/directives/responsiveImage.js",
],
libJavascript: [
'node_modules/angular/angular.min.js',
'node_modules/@uirouter/angularjs/release/angular-ui-router.min.js',
'node_modules/materialize-css/dist/js/materialize.min.js'
"node_modules/angular/angular.min.js",
"node_modules/@uirouter/angularjs/release/angular-ui-router.min.js",
"node_modules/materialize-css/dist/js/materialize.min.js",
],
styles: 'styles/*.css'
}
styles: "styles/*.css",
},
};

// destination configuration object
var destConfig = {
paths: {
images: 'dist/images',
javascript: 'dist/scripts',
styles: 'dist/styles',
stylesUncss: 'dist/stylesUncss',
libJavascript: 'dist/scripts/lib'
}
images: "dist/images",
javascript: "dist/scripts",
styles: "dist/styles",
stylesUncss: "dist/stylesUncss",
libJavascript: "dist/scripts/lib",
},
};

// browser-sync task
gulp.task('browser-sync', function () {
gulp.task("browser-sync", function () {
browserSync.init({
files: [config.paths.files],
browser: config.browser,
port: config.port,
server: {
baseDir: './',
middleware: [historyApiFallback()]
}
baseDir: "./",
middleware: [historyApiFallback()],
},
});
});

// image task
gulp.task('images', function () {
gulp.task("images", function () {
return gulp
.src(config.paths.images)
.pipe(imagemin({
progressive: true
}))
.pipe(
imagemin({
progressive: true,
})
)
.pipe(gulp.dest(destConfig.paths.images));
});

// Library scripts task
gulp.task('lib-scripts', function () {
gulp.task("lib-scripts", function () {
return gulp
.src(config.paths.libJavascript)
.pipe(concat('lib-bundle.js'))
.pipe(rename({
suffix: '.min'
}))
.pipe(concat("lib-bundle.js"))
.pipe(
rename({
suffix: ".min",
})
)
.pipe(gulp.dest(destConfig.paths.libJavascript));
});

// Scripts task
gulp.task('scripts', gulp.series('lib-scripts'), function () {
gulp.task("scripts", gulp.series("lib-scripts"), function () {
return gulp
.src(config.paths.applicationJavascript)
.pipe(concat('bundle.js'))
.pipe(rename({
suffix: '.min'
}))
.pipe(concat("bundle.js"))
.pipe(
rename({
suffix: ".min",
})
)
.pipe(gulp.dest(destConfig.paths.javascript));
});

// linting task
gulp.task('lint', function () {
gulp.task("lint", function () {
return gulp
.src(config.paths.applicationJavascript)
.pipe(lint({
config: 'eslint.config.json'
}))
.pipe(
lint({
config: "eslint.config.json",
})
)
.pipe(lint.format());
});

//uncss-ing task
gulp.task('uncss', function () {
gulp.task("uncss", function () {
return gulp
.src(config.paths.styles)
.pipe(
uncss({
html: ['index.html', 'templates/**/*.html']
html: ["index.html", "templates/**/*.html"],
})
)
.pipe(gulp.dest(destConfig.paths.stylesUncss));
});

// crass, used for CSS minification
gulp.task('crass', function () {
gulp.task("crass", function () {
return gulp
.src(config.paths.styles)
.pipe(crass({
pretty: false
}))
.pipe(
crass({
pretty: false,
})
)
.pipe(gulp.dest(destConfig.paths.styles));
});

// watch task for any html/js changes
gulp.task('watch', function () {
gulp.watch(config.paths.applicationJavascript, gulp.series('lint'));
gulp.watch(config.paths.applicationJavascript, gulp.series('scripts'));
gulp.watch(config.paths.libJavascript, gulp.series('lib-scripts'));
gulp.watch(config.paths.images, gulp.series('images'));
gulp.watch(config.paths.styles, gulp.series('crass'));
gulp.task("watch", function () {
gulp.watch(config.paths.applicationJavascript, gulp.series("lint"));
gulp.watch(config.paths.applicationJavascript, gulp.series("scripts"));
gulp.watch(config.paths.libJavascript, gulp.series("lib-scripts"));
gulp.watch(config.paths.images, gulp.series("images"));
gulp.watch(config.paths.styles, gulp.series("crass"));
});

// default gulp tasks
var defaultTasks = gulp.parallel('browser-sync', 'watch')
var defaultTasks = gulp.parallel("browser-sync", "watch");

gulp.task('default', defaultTasks, function () {});
gulp.task("default", defaultTasks, function () {});
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
/>

<!-- Apple touch device props and icons -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="#26a69a" />
<link
rel="apple-touch-icon"
Expand Down
Loading

0 comments on commit eae5b76

Please sign in to comment.