Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Commit 0ee3179

Browse files
authored
Merge pull request #129 from justcoded/develop
Develop
2 parents 8712e4e + bd14ce4 commit 0ee3179

20 files changed

+193
-147
lines changed

README.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ Web Starter Kit (WSK) - is an opinionated boilerplate for web development. Tools
2121
9. [Templating](#templating)
2222
10. [Styles](#styles)
2323
11. [JavaScript](#javascript)
24-
12. [Tasks](#tasks)
25-
13. [Troubleshooting](#troubleshooting)
26-
14. [Contributing](#contributing)
27-
15. [License](#license)
24+
12. [Watching](#watching)
25+
13. [Images copy and minify](#images-copy-and-minify)
26+
14. [Tasks](#tasks)
27+
15. [Troubleshooting](#troubleshooting)
28+
16. [Contributing](#contributing)
29+
17. [License](#license)
2830

2931

3032
## Browser Support
@@ -36,7 +38,7 @@ At present, we officially aim to support the last two versions of the following
3638
* Firefox
3739
* Safari
3840
* iOS
39-
* Android 5+
41+
* ChromeAndroid
4042

4143
This is not to say that WSK cannot be used in browsers older than those reflected, but merely that our focus will be on ensuring our layouts work great in the above.
4244

@@ -128,7 +130,9 @@ You may also want to get used to some of the [commands](#commands) available.
128130

129131
There are few commands available to help you build and test sites:
130132

131-
### Watch For Changes & Automatically Refresh Across Devices
133+
### Development mode
134+
135+
Watch For Changes & Automatically Refresh Across Devices
132136

133137
```sh
134138
$ gulp
@@ -139,7 +143,9 @@ This includes linting as well as image, script, stylesheet and HTML optimization
139143
Also, a [browsersync](https://browsersync.io/) script will be automatically generated, which will take care of precaching your sites resources.
140144

141145

142-
### Serve the Fully Built & Optimized Site
146+
### Production mode
147+
148+
Serve the Fully Built & Optimized Site
143149

144150
```sh
145151
$ gulp build
@@ -247,15 +253,15 @@ So while normal CSS doesn’t yet allow things like variables, mixins (reusable
247253
* After installing the extension you must **include** its **css** or **sass** files in `src/vendor_entries/vendor.scss` using `@import`.
248254

249255
You are able to add your own **custom sass files** and optionally **disable/enable** [postcss-sort-css-media-queries](https://github.com/solversgroup/postcss-sort-media-queries).
250-
You can see this property `getPathesForStylesCustom` in the `gulp-config.js` file:
256+
You can see this property `getFilesForStylesCustom` in the `gulp-config.js` file:
251257

252-
![image](https://user-images.githubusercontent.com/38295556/72220657-88b3c400-355b-11ea-90d7-4cbb5edb0f43.png)
258+
![image](https://user-images.githubusercontent.com/38295556/72877232-2c8e3400-3d01-11ea-9653-ffd6fec69b28.png)
253259

254260
Please don't forget to link all your **styles custom files** in **html** file:
255261

256262
![image](https://user-images.githubusercontent.com/38295556/72220723-4b036b00-355c-11ea-841a-ce218c304aed.png)
257263

258-
Also, you might want to add files to the ignore list (check `getPathesToCopyForProduction` and `getPathesToCopy` properties in the `gulp-config.js` file). By default they will be copied to the `assets` and `production` folders.
264+
Also, you might want to add files to the ignore list (check `getFilesToCopyProd` and `getFilesToCopy` properties in the `gulp-config.js` file). By default they will be copied to the `assets` and `production` folders.
259265

260266
In our WSK you can use [PostCSS](https://postcss.org/). PostCSS is a tool for transforming CSS with JavaScript. Currently, PostCSS has more than 200 plugins. You can find all of the plugins in the [plugins list](https://github.com/postcss/postcss/blob/master/docs/plugins.md).
261267

@@ -288,6 +294,16 @@ In **production** mode we use:
288294

289295
For linting javascript files in WSK used [esLint](https://eslint.org/). esLint a linter tool for identifying and reporting on patterns in JavaScript (used [airbnb-base rules](https://www.npmjs.com/package/eslint-config-airbnb-base)) and some custom rules in file configuration `.eslintrc`.
290296

297+
## Watching
298+
299+
After run `gulp` by default gulp watching for your files in `src` and `assets` folders.
300+
For `js`, `scss`, `html` and `vendors_entries` folders after change in included files, watcher run they tasks for compiling. For `images` and other folders (and files in `src` root) watcher run tasks for copy files.
301+
302+
## Images copy and minify
303+
304+
In our WSK by default in [development and production mode](#commands), task `build-images` only copy images.
305+
For minify images used [gulp-imagemin](https://github.com/sindresorhus/gulp-imagemin). If you want to minify your images in production mode, please switch option `buildImages.isImageMin = true` in `gulp-config.js`.
306+
291307
## Tasks
292308

293309
| Task | Description |
@@ -301,11 +317,11 @@ For linting javascript files in WSK used [esLint](https://eslint.org/). esLint a
301317
| build-styles-vendors | Compiles all vendor styles from `src/vendor_entries` to `assets/css` folder. |
302318
| clean-build | Cleaning `assets` folder. |
303319
| clean-production | Cleaning `production` folder. |
304-
| copy-folders-production | Copy all folders & files from `assets` to `production`. |
305-
| copy-folders | Copy all not compiling files & folders from `src` to `assets`. |
320+
| copy-files | Copy all not compiling files & folders from `src` to `assets`. |
321+
| copy-files-production | Copy all files & folders from `assets` to `production`. |
306322
| lint-html | Need to lint html files. |
307323
| lint-js | Need to lint & fix js files. |
308-
| image-min | We use this to minify images. |
324+
| build-images | We use this to copy images & minify for production. |
309325
| watch | Task for watching all the changes. |
310326

311327
## Troubleshooting

gulp-config.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ module.exports = {
1313
vendorJs: 'vendor.js',
1414
vendorJsMin: 'vendor.min.js',
1515
vendorJsTemp: 'vendor.temp.js',
16-
mainScss: 'styles.scss',
17-
mainScssMin: 'styles.min.css',
18-
vendorScss: 'vendor.scss',
19-
vendorScssMin: 'vendor.min.css',
16+
mainStyles: 'styles.css',
17+
mainStylesMin: 'styles.min.css',
18+
vendorStyles: 'vendor.css',
19+
vendorStylesMin: 'vendor.min.css',
2020
},
2121
buildHtml: {
2222
templates: 'src/html/templates',
@@ -26,6 +26,10 @@ module.exports = {
2626
// Sorting type css media queries: 'desktop-first' || 'mobile-first'
2727
sortType: 'desktop-first',
2828
},
29+
buildImages: {
30+
imageExtensions: 'jpg,jpeg,png,svg,gif,ico',
31+
isImageMin: false,
32+
},
2933
task: {
3034
lintHtml: 'lint-html',
3135
lintJs: 'lint-js',
@@ -35,28 +39,31 @@ module.exports = {
3539
buildStyles: 'build-styles',
3640
buildStylesCustom: 'build-styles-custom',
3741
buildStylesVendors: 'build-styles-vendors',
38-
imageMin: 'image-min',
42+
buildImages: 'build-images',
3943
cleanProd: 'clean-production',
4044
cleanBuild: 'clean-build',
41-
copyFolders: 'copy-folders',
42-
copyFoldersProd: 'copy-folders-production',
45+
copyFiles: 'copy-files',
46+
copyFilesProd: 'copy-files-production',
4347
browserSync: 'browser-sync-server',
4448
watch: 'watch',
4549
},
46-
imageExtensions: 'jpg|jpeg|png|svg|gif|ico|tiff',
47-
getPathesForStylesCustom: function () {
50+
error: {
51+
icon: './sys_icon/error_icon.png',
52+
wait: true,
53+
},
54+
getFilesForStylesCustom: function() {
4855
return {
4956
files: [],
5057
isGcmq: false,
5158
};
5259
},
53-
getPathesToCopyForProduction: function () {
60+
getFilesToCopyProd: function() {
5461
return [
5562
`./${this.folder.build}/**`,
5663
'.htaccess',
5764
];
5865
},
59-
getPathesToCopy: function () {
66+
getFilesToCopy: function() {
6067
return [
6168
`./${this.folder.src}/**`,
6269
`!{${this.folder.src}/images,${this.folder.src}/images/**}`,

gulpfile.js

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,24 @@
9393
requireTask(`${cfg.task.buildHtml}`, `./${cfg.folder.tasks}/`, {
9494
templates: cfg.buildHtml.templates,
9595
dest: cfg.buildHtml.dest,
96+
mainJs: cfg.file.mainJs,
97+
mainJsMin: cfg.file.mainJsMin,
98+
vendorJs: cfg.file.vendorJs,
99+
vendorJsMin: cfg.file.vendorJsMin,
100+
mainStyles: cfg.file.mainStyles,
101+
mainStylesMin: cfg.file.mainStylesMin,
102+
vendorStyles: cfg.file.vendorStyles,
103+
vendorStylesMin: cfg.file.vendorStylesMin,
104+
error: cfg.error,
105+
checkProduction: true,
96106
});
97107

98108
/**
99109
* Lint HTML
100110
*/
101111
requireTask(`${cfg.task.lintHtml}`, `./${cfg.folder.tasks}/`, {
102112
dest: cfg.buildHtml.dest,
113+
error: cfg.error,
103114
});
104115

105116
/**
@@ -118,6 +129,7 @@
118129
dest: cfg.folder.build,
119130
mainJs: cfg.file.mainJs,
120131
mainJsMin: cfg.file.mainJsMin,
132+
error: cfg.error,
121133
checkProduction: true,
122134
});
123135

@@ -131,6 +143,7 @@
131143
vendorJs: cfg.file.vendorJs,
132144
vendorJsMin: cfg.file.vendorJsMin,
133145
vendorJsTemp: cfg.file.vendorJsTemp,
146+
error: cfg.error,
134147
checkProduction: true,
135148
});
136149

@@ -140,19 +153,21 @@
140153
requireTask(`${cfg.task.buildStyles}`, `./${cfg.folder.tasks}/`, {
141154
src: cfg.folder.src,
142155
dest: cfg.folder.build,
143-
mainScss: cfg.file.mainScss,
144-
mainScssMin: cfg.file.mainScssMin,
156+
mainStyles: cfg.file.mainStyles,
157+
mainStylesMin: cfg.file.mainStylesMin,
145158
sortType: cfg.buildStyles.sortType,
159+
error: cfg.error,
146160
checkProduction: true,
147161
});
148162

149163
/**
150164
* Build styles custom files listed in the config
151165
*/
152166
requireTask(`${cfg.task.buildStylesCustom}`, `./${cfg.folder.tasks}/`, {
153-
stylesCustomInfo: cfg.getPathesForStylesCustom(),
167+
stylesCustomInfo: cfg.getFilesForStylesCustom(),
154168
dest: cfg.folder.build,
155169
sortType: cfg.buildStyles.sortType,
170+
error: cfg.error,
156171
checkProduction: true,
157172
});
158173

@@ -162,17 +177,21 @@
162177
requireTask(`${cfg.task.buildStylesVendors}`, `./${cfg.folder.tasks}/`, {
163178
src: cfg.folder.src,
164179
dest: cfg.folder.build,
165-
vendorScss: cfg.file.vendorScss,
166-
vendorScssMin: cfg.file.vendorScssMin,
180+
vendorStyles: cfg.file.vendorStyles,
181+
vendorStylesMin: cfg.file.vendorStylesMin,
182+
error: cfg.error,
167183
checkProduction: true,
168184
});
169185

170186
/**
171-
* Minify images
187+
* Copy & minify images
172188
*/
173-
requireTask(`${cfg.task.imageMin}`, `./${cfg.folder.tasks}/`, {
189+
requireTask(`${cfg.task.buildImages}`, `./${cfg.folder.tasks}/`, {
174190
src: cfg.folder.src,
175191
dest: cfg.folder.build,
192+
imageExtensions: cfg.buildImages.imageExtensions,
193+
isImageMin: cfg.buildImages.isImageMin,
194+
checkProduction: true,
176195
});
177196

178197
/**
@@ -193,17 +212,17 @@
193212
/**
194213
* Copy folders to the build folder
195214
*/
196-
requireTask(`${cfg.task.copyFolders}`, `./${cfg.folder.tasks}/`, {
215+
requireTask(`${cfg.task.copyFiles}`, `./${cfg.folder.tasks}/`, {
197216
dest: cfg.folder.build,
198-
foldersToCopy: cfg.getPathesToCopy(),
217+
filesToCopy: cfg.getFilesToCopy(),
199218
});
200219

201220
/**
202221
* Copy folders to the production folder
203222
*/
204-
requireTask(`${cfg.task.copyFoldersProd}`, `./${cfg.folder.tasks}/`, {
223+
requireTask(`${cfg.task.copyFilesProd}`, `./${cfg.folder.tasks}/`, {
205224
dest: cfg.folder.prod,
206-
foldersToCopy: cfg.getPathesToCopyForProduction(),
225+
filesToCopyProd: cfg.getFilesToCopyProd(),
207226
});
208227

209228
/**
@@ -221,17 +240,20 @@
221240
requireTask(`${cfg.task.watch}`, `./${cfg.folder.tasks}/`, {
222241
src: cfg.folder.src,
223242
dest: cfg.folder.build,
224-
imageExtensions: cfg.imageExtensions,
243+
filesToCopy: cfg.getFilesToCopy(),
225244
browserSync,
226245
deleteFile,
227246
tasks: {
228247
lintJs: cfg.task.lintJs,
229248
buildJs: cfg.task.buildJs,
249+
buildJsVendors: cfg.task.buildJsVendors,
230250
buildStyles: cfg.task.buildStyles,
231251
buildStylesCustom: cfg.task.buildStylesCustom,
252+
buildStylesVendors: cfg.task.buildStylesVendors,
232253
buildHtml: cfg.task.buildHtml,
233254
lintHtml: cfg.task.lintHtml,
234-
imageMin: cfg.task.imageMin,
255+
buildImages: cfg.task.buildImages,
256+
copyFiles: cfg.task.copyFiles,
235257
},
236258
}, false);
237259

@@ -256,21 +278,22 @@
256278
cfg.task.buildJsVendors,
257279
),
258280
),
259-
cfg.task.imageMin,
260-
cfg.task.copyFolders,
281+
cfg.task.buildImages,
282+
cfg.task.copyFiles,
261283
gulp.parallel(
262284
cfg.task.browserSync,
263285
cfg.task.watch,
264286
),
265-
));
287+
)
288+
);
266289

267290
/**
268291
* Creating production folder without unnecessary files
269292
*/
270293
gulp.task('build', gulp.series(
271294
gulp.parallel(
272295
cfg.task.cleanProd,
273-
cfg.task.cleanBuild
296+
cfg.task.cleanBuild,
274297
),
275298
cfg.task.lintJs,
276299
gulp.parallel(
@@ -288,9 +311,9 @@
288311
cfg.task.buildJsVendors,
289312
),
290313
),
291-
cfg.task.imageMin,
292-
cfg.task.copyFolders,
293-
cfg.task.copyFoldersProd,
314+
cfg.task.buildImages,
315+
cfg.task.copyFiles,
316+
cfg.task.copyFilesProd,
294317
), true);
295318

296319
/**

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web-starter-jc",
3-
"version": "3.0.0",
3+
"version": "3.0.2",
44
"description": "Starter kit for markup projects",
55
"repository": {
66
"type": "git",
@@ -37,7 +37,7 @@
3737
"gulp-file-include": "^2.1.1",
3838
"gulp-htmlhint": "^3.0.0",
3939
"gulp-if": "^3.0.0",
40-
"gulp-imagemin": "^6.2.0",
40+
"gulp-imagemin": "^7.1.0",
4141
"gulp-newer": "^1.4.0",
4242
"gulp-notify": "^3.2.0",
4343
"gulp-postcss": "^8.0.0",
@@ -49,7 +49,7 @@
4949
"path": "^0.12.7",
5050
"postcss-import": "^12.0.1",
5151
"postcss-sort-media-queries": "^1.0.15",
52-
"sass": "^1.24.4",
52+
"sass": "^1.25.0",
5353
"vinyl-buffer": "^1.0.1",
5454
"vinyl-source-stream": "^2.0.0"
5555
},

src/html/partials/head/head.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<meta charset="utf-8">
33
<meta name="viewport" content="width=device-width, initial-scale=1.0">
44
<title>Web Starter Kit</title>
5-
<link media="all" rel="stylesheet" href="css/vendor.min.css">
6-
<link media="all" rel="stylesheet" href="css/styles.min.css">
7-
</head>
5+
<link media="all" rel="stylesheet" href="@@webRoot/css/@@vendorStyles">
6+
<link media="all" rel="stylesheet" href="@@webRoot/css/@@mainStyles">
7+
</head>

src/html/partials/scripts/common.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<script src="js/vendor.min.js" defer></script>
2-
<script src="js/app.min.js" defer></script>
1+
<script src="@@webRoot/js/@@vendorJs" defer></script>
2+
<script src="@@webRoot/js/@@mainJs" defer></script>

src/vendor_entries/vendor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ module.exports = {
88
es6: [
99
// './node_modules/your-plugin/es6/your-plugin.js',
1010
]
11-
};
11+
};

0 commit comments

Comments
 (0)