Skip to content

Commit 87e113a

Browse files
committed
[TASK] HTML: Add html partials and new checks
1 parent e247b9b commit 87e113a

29 files changed

+212
-520
lines changed

β€Ž.eslintrcβ€Ž

Lines changed: 0 additions & 16 deletions
This file was deleted.

β€Ž.sass-lint.ymlβ€Ž

Lines changed: 0 additions & 90 deletions
This file was deleted.

β€ŽREADME.mdβ€Ž

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
## License
1+
# 🏝️ Marynah 🏝️
22

3-
See [here](https://github.com/KonradRolof/DropLoad/blob/master/LICENSE)
3+
A simple GULP setup
44

5-
## Install
5+
## Installation
66

7+
Clone the repo into a folder, navigate into the folder and execute
8+
```
79
yarn install
10+
```
811

9-
## Start
12+
## For development
1013

11-
### For building all files
12-
yarn start
13-
14-
### For developing
14+
This command generates all files, opens the page in the browser and watches for changes
15+
```
1516
yarn dev
17+
```
18+
19+
## For building
20+
21+
This command generates all files
22+
```
23+
yarn start
24+
```

β€Žgulpfile.config.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = {
2222
html: {
2323
src: 'src/*.html',
2424
dist: 'dist',
25-
watch: 'src/*.html'
25+
watch: 'src/**/*.html'
2626
},
2727
images: {
2828
src: 'src/img/**/*.*',

β€Žgulpfile.jsβ€Ž

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const gulp = require('gulp');
1616
const del = require('del');
1717
const htmlmin = require('gulp-htmlmin');
1818
const concat = require('gulp-concat');
19+
const injectPartials = require('gulp-inject-partials');
1920

2021
// load config
2122
const CONFIG = require('./gulpfile.config');
@@ -42,37 +43,42 @@ function browserSyncReload(done) {
4243
}
4344

4445
// compile styles specific for DropLoad
45-
function dlStyles() {
46-
return gulp
47-
.src(CONFIG.styles.src)
48-
.pipe(plumber())
49-
// normal file
50-
.pipe(sourceMaps.init())
51-
.pipe(gulpSass({ outputStyle: 'expanded' }))
52-
.pipe(gulp.dest(CONFIG.styles.dist))
53-
// minified versions
54-
.pipe(rename({ suffix: '.min' }))
55-
.pipe(postCSS([autoprefixer(['last 2 versions']), cssNano()]))
56-
.pipe(gulp.dest(CONFIG.styles.dist))
57-
// concatenated
58-
.pipe(concat('app.css'))
59-
.pipe(gulp.dest(CONFIG.styles.dist))
60-
.pipe(browserSync.stream());
46+
function compileStyles() {
47+
return (
48+
gulp
49+
.src(CONFIG.styles.src)
50+
.pipe(plumber())
51+
// normal file
52+
.pipe(sourceMaps.init())
53+
.pipe(gulpSass({ outputStyle: 'expanded' }))
54+
.pipe(gulp.dest(CONFIG.styles.dist))
55+
// minified versions
56+
.pipe(rename({ suffix: '.min' }))
57+
.pipe(postCSS([autoprefixer(['last 2 versions']), cssNano()]))
58+
.pipe(gulp.dest(CONFIG.styles.dist))
59+
// concatenated
60+
.pipe(concat('app.css'))
61+
.pipe(gulp.dest(CONFIG.styles.dist))
62+
.pipe(browserSync.stream())
63+
);
6164
}
6265

6366
// generate images
6467
function copyImages() {
65-
return gulp.src(CONFIG.images.src)
66-
.pipe(changed(CONFIG.images.dist))
67-
.pipe(gulp.dest(CONFIG.images.dist))
68-
.pipe(imagemin({
69-
optimizationLevel: 5,
70-
progressive: true,
71-
svgoPlugins: [{ removeViewBox: false }],
72-
interlaced: true
73-
}))
74-
.pipe(rename({ suffix: '_minified' }))
75-
.pipe(gulp.dest(CONFIG.images.dist));
68+
return (
69+
gulp.src(CONFIG.images.src)
70+
.pipe(changed(CONFIG.images.dist))
71+
.pipe(gulp.dest(CONFIG.images.dist))
72+
.pipe(imagemin({
73+
optimizationLevel: 5,
74+
progressive: true,
75+
svgoPlugins: [{ removeViewBox: false }],
76+
interlaced: true
77+
}))
78+
.pipe(rename({ suffix: '_minified' }))
79+
.pipe(gulp.dest(CONFIG.images.dist))
80+
.pipe(browserSync.stream())
81+
);
7682
}
7783

7884
// generate scripts
@@ -96,21 +102,12 @@ function scripts() {
96102
);
97103
}
98104

99-
100-
// file watchers
101-
function watchFiles() {
102-
gulp.watch(CONFIG.styles.watch, gulp.parallel(dlStyles));
103-
gulp.watch(CONFIG.scripts.watch, gulp.parallel(scripts));
104-
gulp.watch(CONFIG.html.watch, html, browserSyncReload);
105-
gulp.watch(CONFIG.fonts.watch, fonts, browserSyncReload);
106-
gulp.watch(CONFIG.css.watch, copyCss, browserSyncReload);
107-
}
108-
109105
// copy and minify html
110106
function copyHtml() {
111107
return (
112108
gulp
113109
.src(CONFIG.html.src)
110+
.pipe(injectPartials())
114111
.pipe(gulp.dest(CONFIG.html.dist))
115112
.pipe(htmlmin({ collapseWhitespace: true }))
116113
.pipe(rename({ suffix: '_min' }))
@@ -135,11 +132,21 @@ function copyCss() {
135132
gulp
136133
.src(CONFIG.css.src)
137134
.pipe(gulp.dest(CONFIG.css.dist))
135+
.pipe(browserSync.stream())
138136
);
139137
}
140138

139+
// file watchers
140+
function watchFiles() {
141+
gulp.watch(CONFIG.styles.watch, compileStyles, browserSyncReload);
142+
gulp.watch(CONFIG.scripts.watch, scripts, browserSyncReload);
143+
gulp.watch(CONFIG.html.watch, html, browserSyncReload);
144+
gulp.watch(CONFIG.fonts.watch, fonts, browserSyncReload);
145+
gulp.watch(CONFIG.css.watch, styles, browserSyncReload);
146+
}
147+
141148
const js = gulp.parallel(scripts);
142-
const styles = gulp.parallel(dlStyles, copyCss);
149+
const styles = gulp.parallel(compileStyles, copyCss);
143150
const images = gulp.parallel(copyImages);
144151
const html = gulp.parallel(copyHtml);
145152
const fonts = gulp.parallel(copyFonts);

β€Žpackage.jsonβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"gulp-environments": "^0.1.2",
2525
"gulp-htmlmin": "^5.0.1",
2626
"gulp-imagemin": "^5.0.3",
27+
"gulp-inject-partials": "^1.0.5",
2728
"gulp-plumber": "^1.2.1",
2829
"gulp-postcss": "^8.0.0",
2930
"gulp-rename": "^1.4.0",

β€Žsrc/css/style.cssβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
* {
2-
color: red;
1+
.check-css-folder {
2+
color: green;
33
}

β€Žsrc/html/_checks.htmlβ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<h2>Checks</h2>
2+
<div class="check-css-folder">
3+
<p>If this text is green, the css folder was loaded correctly.</p>
4+
</div>
5+
<div class="check-scss-folder">
6+
<p>If this text is green, the scss folder was loaded correctly.</p>
7+
</div>
8+
<div class="check-js-folder">
9+
<p>If this text is green, the js folder was loaded correctly.</p>
10+
</div>
11+
<div class="check-img-folder">
12+
<p>Original Image</p>
13+
<img src="img/test.png" alt="The image was not loaded correctly or the image was not found.">
14+
<p>Minified Image</p>
15+
<img src="img/test_minified.png" alt="The minified image was not loaded correctly or the image was not found.">
16+
</div>

β€Žsrc/html/_hero.htmlβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<header>
2+
<h1>🏝️ Marynah 🏝️</h1>
3+
<p>A simple GULP setup</p>
4+
</header>

β€Žsrc/img/screen.jpegβ€Ž

-26.1 KB
Binary file not shown.

0 commit comments

Comments
Β (0)