Skip to content

Commit

Permalink
More changes. I never know what to type here.
Browse files Browse the repository at this point in the history
  • Loading branch information
Woedenaz committed Jul 4, 2019
1 parent c55db11 commit e5348f7
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 78 deletions.
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
*.swp
# Artifacts
node_modules/
*.map
*.bak

# mac items
# Misc
.DS_Store
.*.swp
*.bak

# node items
node_modules/
#node
package-lock.json
1 change: 1 addition & 0 deletions dist/js/main.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gulp-tasks/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ function copyAssets(done) {

if (!fs.existsSync(distFile)) {
fs.copyFile(srcFile, distFile, err => {
if (err) throw err;
if (err) {
console.log(err);
}
});
}
});
Expand Down
63 changes: 0 additions & 63 deletions gulp-tasks/images.js
Original file line number Diff line number Diff line change
@@ -1,69 +1,7 @@
// packages
const fs = require("fs");
const glob = require("glob");
const path = require("path");
const sharp = require("sharp");
const imagemin = require("gulp-imagemin");
const gulp = require("gulp");

// specify transforms
const transforms = [
{
src: "./src/img/blogposts/*",
dist: "./dist/img/blogposts/_1024x576/",
options: {
width: 1024,
height: 576,
fit: "cover"
}
},
{
src: "./src/img/blogposts/*",
dist: "./dist/img/blogposts/_600x600/",
options: {
width: 600,
height: 600,
fit: "cover"
}
},
{
src: "./src/img/projects/*",
dist: "./dist/img/projects/_800x600/",
options: {
width: 800,
height: 600,
fit: "cover"
}
}
];

// resize images
function resizeImages(done) {
transforms.forEach(function(transform) {
// if folder does not exist create it with all above folders
if (!fs.existsSync(transform.dist)) {
fs.mkdirSync(transform.dist, { recursive: true }, err => {
if (err) throw err;
});
}

// glob all files
let files = glob.sync(transform.src);

// for each file, apply transforms and save to file
files.forEach(function(file) {
let filename = path.basename(file);
sharp(file)
.resize(transform.options)
.toFile(`${transform.dist}/${filename}`)
.catch(err => {
console.log(err);
});
});
});
done();
}

// optimize images in place
function optimiseImages() {
return gulp
Expand All @@ -83,6 +21,5 @@ function optimiseImages() {

// exports (Common JS)
module.exports = {
resize: resizeImages,
optimise: optimiseImages
};
8 changes: 4 additions & 4 deletions gulp-tasks/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ function scriptsLint() {
function scriptsBuild() {
return (
gulp
.src(
["./src/js/main.js"],
{ allowEmpty: true }
)
.src([
"./src/js/**/*.js",
"./src/js/*.js"
])
.pipe(webpackstream(webpackconfig, webpack))
// folder only, filename is specified in webpack
.pipe(gulp.dest("./dist/js/"))
Expand Down
1 change: 0 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const build = gulp.series(
gulp.parallel(
copy.assets,
css.build,
img.resize,
gulp.series(js.lint, js.build)
)
);
Expand Down
8 changes: 4 additions & 4 deletions src/css/root.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@
rgba(var(--background-gradient-color),0.987) calc(0.008 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.951) calc(0.029 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.896) calc(0.064 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.825) calc(0.11 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.825) calc(0.110 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.741) calc(0.166 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.648) calc(0.231 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.55) calc(0.304 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.45) calc(0.383 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.550) calc(0.304 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.450) calc(0.383 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.352) calc(0.467 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.259) calc(0.554 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.175) calc(0.644 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.104 )calc(0.735 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.104) calc(0.735 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.049) calc(0.825 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0.013) calc(0.914 * var(--background-gradient-distance)),
rgba(var(--background-gradient-color),0) var(--background-gradient-distance));
Expand Down

0 comments on commit e5348f7

Please sign in to comment.