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

Commit 0cf083a

Browse files
authored
Merge pull request #136 from Kassaila/develop
Develop
2 parents 3ecdc6f + 34c3434 commit 0cf083a

36 files changed

+593
-764
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": [
3+
["@babel/env", {"modules": false}]
4+
],
5+
"plugins": []
6+
}

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ composer.lock
1919
# Ignore Mac DS_Store files
2020
.DS_Store
2121
._*
22-
node_modules/
2322
.com.apple.timemachine.supported
2423

2524
# linux backup files
@@ -31,7 +30,6 @@ node_modules/
3130
/production/
3231
/.temp/
3332
.sass-cache
34-
node_modules
3533
*.map
3634
/*.html
3735
.tmp
@@ -42,4 +40,5 @@ tmp
4240
/wp-content/uploads/*
4341

4442
#npm dependencies
45-
package-lock.json
43+
/node_modules/
44+
package-lock.json

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ branches:
44
only:
55
- master
66
node_js:
7+
- '13'
78
- '12'
89
- '11'
9-
- '10'
10+
- '10'

README.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> A modern Web starter kit for projects
44
5-
![node](http://img.shields.io/badge/node-8.0.x-blue.svg) ![npm](https://img.shields.io/badge/npm-5.0.x-blue.svg) [![release](https://img.shields.io/github/release/justcoded/web-starter-kit.svg)](/releases) ![SCSS](http://img.shields.io/badge/SCSS-3.x.x-c6538c.svg) [![travis](https://img.shields.io/travis/justcoded/web-starter-kit.svg)](https://travis-ci.org) [![license](http://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![license](http://img.shields.io/badge/autoprefixer-included-blue.svg)](https://www.npmjs.com/package/autoprefixer) [![readme](http://img.shields.io/badge/readme-md-blue.svg)](/README.md) [![requests](http://img.shields.io/badge/PRs-welcome-green.svg)](/pulls)
5+
![node](http://img.shields.io/badge/node-10.0.x-blue.svg) ![npm](https://img.shields.io/badge/npm-5.6.x-blue.svg) [![release](https://img.shields.io/github/release/justcoded/web-starter-kit.svg)](/releases) ![SCSS](http://img.shields.io/badge/SCSS-3.x.x-c6538c.svg) [![travis](https://img.shields.io/travis/justcoded/web-starter-kit.svg)](https://travis-ci.org) [![license](http://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![license](http://img.shields.io/badge/autoprefixer-included-blue.svg)](https://www.npmjs.com/package/autoprefixer) [![readme](http://img.shields.io/badge/readme-md-blue.svg)](/README.md) [![requests](http://img.shields.io/badge/PRs-welcome-green.svg)](/pulls)
66

77

88
## Overview
@@ -50,8 +50,8 @@ This is not to say that WSK cannot be used in browsers older than those reflecte
5050
| Easy start | We don't use responsive boilerplate. You are free to make your own decision in what way to make responsive for the site. Just start with `index.html` from `src/html`. |
5151
| HTML templating | Used [gulp-file-include](https://github.com/haoxins/gulp-file-include) for templating html files. |
5252
| Sass support | Compile [Sass](http://sass-lang.com/) into CSS with ease, bringing support for variables, mixins and more (run `gulp` for project compiling). In our WSK we use [Dart-Sass](https://sass-lang.com/dart-sass) version compiler and follow [Sass guidelines](https://sass-guidelin.es/#architecture). |
53-
| PostCSS support | PostCSS connecting most usable plugins library for CSS optimisation. In our WSK we use [autoprefixer](https://github.com/postcss/autoprefixer), [cssnano](https://github.com/cssnano/cssnano), [sort-css-media-queries](https://github.com/solversgroup/postcss-sort-media-queries), etc. |
54-
| JavaScript ES6+ Support | Optional JavaScript ES6+ support .You can use all kind of ES6+ features here. ES6+ source code will be automatically transpiled to ES5 for wide browser support. For bundling and transpiling used [Browserify](http://browserify.org/) and [Babel](https://babeljs.io/). |
53+
| PostCSS support | PostCSS connecting most usable plugins library for CSS optimisation. In our WSK we use [autoprefixer](https://github.com/postcss/autoprefixer), [cssnano](https://github.com/cssnano/cssnano), [postcss-sort-media-queries](https://github.com/solversgroup/postcss-sort-media-queries), etc. |
54+
| JavaScript ES6+ Support | Optional JavaScript ES6+ support .You can use all kind of ES6+ features here. ES6+ source code will be automatically transpiled to ES5 for wide browser support. For bundling and transpiling used [Rollup](https://rollupjs.org/) and [Babel](https://babeljs.io/). |
5555
| Code Linting | JavaScript code linting is done using [esLint](https://eslint.org/) - a linter tool for identifying and reporting on patterns in JavaScript (used [airbnb-base rules](https://www.npmjs.com/package/eslint-config-airbnb-base)). HTML code linting is done using [HTMLHint](https://github.com/htmlhint/HTMLHint). |
5656
| Performance optimization | Minify and concatenate JavaScript, CSS, HTML and images to help keep your pages lean (run `gulp` to create an optimised version of your project to `assets`). |
5757
| Built-in HTTP Server | A built-in server for previewing your site locally while you develop and iterate. |
@@ -98,7 +98,7 @@ Once you have verified that your system can run WSK, check out the [commands](#c
9898
### [Node.js](https://nodejs.org)
9999

100100
Bring up a terminal and type `node --version`.
101-
Node should respond with a version at or above 8.0.x.
101+
Node should respond with a version at or above 10.0.x.
102102
If you need to install Node, go to [nodejs.org](https://nodejs.org) and click on the big green Install button.
103103

104104
### [Gulp](http://gulpjs.com)
@@ -143,7 +143,7 @@ This includes linting as well as image, script, stylesheet and HTML optimization
143143
Also, a [browsersync](https://browsersync.io/) script will be automatically generated, which will take care of precaching your sites resources.
144144

145145

146-
### Production mode
146+
### Build (production) mode
147147

148148
Serve the Fully Built & Optimized Site
149149

@@ -167,7 +167,7 @@ Included in `gulp` and `gulp build` tasks.
167167
$ gulp fix-js
168168
```
169169

170-
`gulp fix-js` task run auto-fix (eslint fix method) and lint for JS files.
170+
`gulp fix-js` task run lint and auto-fix (eslint method) for JS files.
171171
**Not included in any tasks**.
172172

173173
## Structure
@@ -177,9 +177,11 @@ Your folder structure for WSK:
177177

178178
```
179179
├── assets #Folder with files after compiling
180+
├── helpers #Folder with helpers function for tasks
180181
├── src #Folder with sources
181-
├── sys_icon #Folder with system icons for notification
182+
├── system_files #Folder with system files
182183
├── tasks #Folder with tasks for gulpfile
184+
├── .babelrc #Config for Babel
183185
├── .browserslistrc #Config for autoprefixer
184186
├── .editorconfig #Config for IDE
185187
├── .eslintignore #Eslint ignore list
@@ -226,10 +228,11 @@ In `package.json` you can find all the dependencies. Folder `tasks` - for gulpfi
226228
├── styles.scss #Main file to import project styles (used for importing another files)
227229
├── vendor_entries #Folder for vendor entries (plugins)
228230
├── vendor.js #File for plugins js
231+
├── vendor-compile.js #File for compiling (bunling) plugins js
229232
├── vendor.scss #File for plugins styles
230233
```
231234

232-
Use `images` folder to add your graphic files, `modules` to add your javascript modules (don't forget to include it in app.js), `scss` folder to add your styles for the project. You can create, delete files and folders in `scss`, but don't forget to include them in `scss/styles.scss` file .
235+
Use `images` folder to add your graphic files, `modules` to add your javascript modules (don't forget to include it in app.js), `scss` folder to add your styles for the project. You can create, delete files and folders in `scss`, but don't forget to include them in `scss/styles.scss` file.
233236

234237
Use `vendor_entries` to include plugins into your project.
235238

@@ -252,7 +255,7 @@ So while normal CSS doesn’t yet allow things like variables, mixins (reusable
252255
* All **extensions** must be installed by the [npm](https://docs.npmjs.com/cli/install);
253256
* After installing the extension you must **include** its **css** or **sass** files in `src/vendor_entries/vendor.scss` using `@import`.
254257

255-
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).
258+
You are able to add your own **custom sass files** and optionally **disable/enable** [postcss-sort-media-queries](https://github.com/solversgroup/postcss-sort-media-queries).
256259
You can see this property `getFilesForStylesCustom` in the `gulp-config.js` file:
257260

258261
![image](https://user-images.githubusercontent.com/38295556/72877232-2c8e3400-3d01-11ea-9653-ffd6fec69b28.png)
@@ -267,9 +270,9 @@ In our WSK you can use [PostCSS](https://postcss.org/). PostCSS is a tool for tr
267270

268271
* You **don't need** to write **prefixes** for different browsers like `-webkit` it will be done by the [autoprefixer](https://github.com/postcss/autoprefixer).
269272

270-
In **production** mode we use:
273+
In **build (production)** mode we use:
271274

272-
* **Group and sort CSS media queries** by [sort-css-media-queries](https://github.com/solversgroup/postcss-sort-media-queries). By **default** we use `desktop-first` sorting type, but you can change it in `gulp-config.js` to `mobile-first`.
275+
* **Group and sort CSS media queries** by [postcss-sort-media-queries](https://github.com/solversgroup/postcss-sort-media-queries). By **default** we use `desktop-first` sorting type, but you can change it in `gulp-config.js` to `mobile-first`.
273276
* **Minifying** `.css` files by [cssnano](https://github.com/cssnano/cssnano).
274277

275278
In our WSK we use **CSS3 custom properties** and **relative units** `rem`. By default `1rem = 10px`.
@@ -280,29 +283,30 @@ In our WSK we use **CSS3 custom properties** and **relative units** `rem`. By de
280283

281284
It is not an alternative syntax or language like CoffeeScript or TypeScript. It's good ol' fashioned JavaScript. The reason so many people are excited is that this version introduces a lot of much-needed improvements to the language.
282285

283-
For bundling and transpiling `.js` files in our WSK we used [Browserify](http://browserify.org/) and [Babel](https://babeljs.io/).
286+
For bundling and transpiling `.js` files in our WSK we used [Rollup](https://rollupjs.org/) and [Babel](https://babeljs.io/).
284287

285288
* All custom **javascript** files are located in `js` folder;
286289
* Entry point for javascript is `src/js/app.js` you can **import** all your **javascript** files from here using [ES6 import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) feature;
287290
* All **javascript** is **babelified** so yes! You can use all kind of [ES6 features](https://babeljs.io/docs/learn-es2015/) here.
288291
* All **extensions** must be installed by the [npm](https://docs.npmjs.com/cli/install);
289292
* After installing the extension you must **include** its **javascript** files in `src/vendor_entries/vendor.js` by adding new elements to the **array**.
293+
* If you using ES modules or any types of modules, please import your modules in `src/vendor_entries/vendor-compile.js`.
290294

291-
In **production** mode we use:
295+
In **build (production)** mode we use:
292296

293-
* **Uglifying** `.js` files by [uglifyJS](https://github.com/mishoo/UglifyJS2).
297+
* **Minify** `.js` files by [terser](https://github.com/terser/terser).
294298

295299
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`.
296300

297301
## Watching
298302

299303
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.
304+
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 & reload browser.
301305

302306
## Images copy and minify
303307

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`.
308+
In our WSK by default in [development and build (production) mode](#commands), task `build-images` only copy images.
309+
For minify images used [gulp-imagemin](https://github.com/sindresorhus/gulp-imagemin). If you want to minify your images in build (production) mode, please switch option `buildImages.isImageMin = true` in `gulp-config.js`.
306310

307311
## Tasks
308312

@@ -315,8 +319,7 @@ For minify images used [gulp-imagemin](https://github.com/sindresorhus/gulp-imag
315319
| build-styles | Compiles all scss from `src/scss` to `assets/css` folder. |
316320
| build-styles-custom | Compiles all custom scss files listed in the `gulp-config.js` to `assets/css` folder |
317321
| build-styles-vendors | Compiles all vendor styles from `src/vendor_entries` to `assets/css` folder. |
318-
| clean-build | Cleaning `assets` folder. |
319-
| clean-production | Cleaning `production` folder. |
322+
| clean-build | Cleaning folders for output files. |
320323
| copy-files | Copy all not compiling files & folders from `src` to `assets`. |
321324
| copy-files-production | Copy all files & folders from `assets` to `production`. |
322325
| lint-html | Need to lint html files. |

gulp-config.js

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
module.exports = {
2+
task: {
3+
lintHtml: 'lint-html',
4+
lintJs: 'lint-js',
5+
fixJs: 'fix-js',
6+
buildHtml: 'build-html',
7+
buildJs: 'build-js',
8+
buildJsVendors: 'build-js-vendors',
9+
buildStyles: 'build-styles',
10+
buildStylesCustom: 'build-styles-custom',
11+
buildStylesVendors: 'build-styles-vendors',
12+
buildImages: 'build-images',
13+
cleanBuild: 'clean-build',
14+
copyFiles: 'copy-files',
15+
copyFilesProd: 'copy-files-production',
16+
browserSync: 'browser-sync',
17+
watch: 'watch',
18+
build: 'build',
19+
},
220
folder: {
321
tasks: 'tasks',
422
src: 'src',
5-
build: 'assets',
6-
prod: 'production',
23+
dev: 'assets',
24+
build: 'production',
725
temp: '.temp',
826
},
927
file: {
@@ -12,15 +30,17 @@ module.exports = {
1230
mainJsMin: 'app.min.js',
1331
vendorJs: 'vendor.js',
1432
vendorJsMin: 'vendor.min.js',
33+
vendorJsComp: 'vendor-compile.js',
1534
vendorJsTemp: 'vendor.temp.js',
35+
mainStylesSrc: 'styles.scss',
1636
mainStyles: 'styles.css',
1737
mainStylesMin: 'styles.min.css',
38+
vendorStylesSrc: 'vendor.scss',
1839
vendorStyles: 'vendor.css',
1940
vendorStylesMin: 'vendor.min.css',
2041
},
2142
buildHtml: {
2243
templates: 'src/html/templates',
23-
dest: './assets',
2444
},
2545
buildStyles: {
2646
// Sorting type css media queries: 'desktop-first' || 'mobile-first'
@@ -30,40 +50,19 @@ module.exports = {
3050
imageExtensions: 'jpg,jpeg,png,svg,gif,ico',
3151
isImageMin: false,
3252
},
33-
task: {
34-
lintHtml: 'lint-html',
35-
lintJs: 'lint-js',
36-
buildHtml: 'build-html',
37-
buildJs: 'build-js',
38-
buildJsVendors: 'build-js-vendors',
39-
buildStyles: 'build-styles',
40-
buildStylesCustom: 'build-styles-custom',
41-
buildStylesVendors: 'build-styles-vendors',
42-
buildImages: 'build-images',
43-
cleanProd: 'clean-production',
44-
cleanBuild: 'clean-build',
45-
copyFiles: 'copy-files',
46-
copyFilesProd: 'copy-files-production',
47-
browserSync: 'browser-sync-server',
48-
watch: 'watch',
49-
},
5053
error: {
51-
icon: './sys_icon/error_icon.png',
54+
sound: true,
55+
title: '< SYSTEM ERROR >',
56+
icon: './system_files/icons/error_icon.png',
5257
wait: true,
5358
},
54-
getFilesForStylesCustom: function() {
59+
getFilesForStylesCustom() {
5560
return {
5661
files: [],
5762
isGcmq: false,
5863
};
5964
},
60-
getFilesToCopyProd: function() {
61-
return [
62-
`./${this.folder.build}/**`,
63-
'.htaccess',
64-
];
65-
},
66-
getFilesToCopy: function() {
65+
getFilesToCopy() {
6766
return [
6867
`./${this.folder.src}/**`,
6968
`!{${this.folder.src}/images,${this.folder.src}/images/**}`,
@@ -72,5 +71,17 @@ module.exports = {
7271
`!{${this.folder.src}/scss,${this.folder.src}/scss/**}`,
7372
`!{${this.folder.src}/vendor_entries,${this.folder.src}/vendor_entries/**}`,
7473
];
74+
},
75+
getFilesToCopyProd() {
76+
return [
77+
`./${this.folder.dev}/**`,
78+
'.htaccess',
79+
];
80+
},
81+
isProduction() {
82+
return process.argv[process.argv.length - 1] === this.task.build;
83+
},
84+
isFixJs() {
85+
return process.argv[process.argv.length - 1] === this.task.fixJs;
7586
}
7687
};

0 commit comments

Comments
 (0)