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

Commit 12122b9

Browse files
authored
Merge pull request #7 from Kassaila/feature/update_build-js-tasks
Feature/update build js tasks
2 parents 5ce6302 + aee1655 commit 12122b9

33 files changed

Lines changed: 549 additions & 610 deletions

.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+
}

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"root": true,
23
"globals": {
34
"jQuery": true,
45
"$": true

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ composer.lock
2121
# Ignore Mac DS_Store files
2222
.DS_Store
2323
._*
24-
node_modules/
2524
.com.apple.timemachine.supported
2625

2726
# linux backup files
2827
*~
2928

3029
# markup
3130
.sass-cache
32-
node_modules
3331
/.temp/
3432
*.map
3533
*.tmp
@@ -43,4 +41,5 @@ tmp
4341
*.rar
4442

4543
#npm dependencies
46-
package-lock.json
44+
/node_modules/
45+
package-lock.json

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sudo: false
2+
language: node_js
3+
branches:
4+
only:
5+
- master
6+
node_js:
7+
- '13'
8+
- '12'
9+
- '11'
10+
- '10'

README.md

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

33
> A modern Web starter kit to build projects, ready for WordPress.
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-wp.svg)](/releases) ![SCSS](http://img.shields.io/badge/SCSS-3.x.x-c6538c.svg) [![travis](https://img.shields.io/travis/justcoded/web-starter-kit-wp.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
@@ -25,7 +25,7 @@ Web Starter Kit (WSK) - is an opinionated boilerplate for web development. Tools
2525

2626
## Install
2727

28-
Instruction for installation WSK please read in `master` branch [README.md](https://github.com/justcoded/web-starter-kit/blob/master/README.md#install)
28+
Instruction for installation WSK please read in main repo [README.md](https://github.com/justcoded/web-starter-kit/blob/master/README.md#install)
2929

3030

3131
## Commands
@@ -45,7 +45,7 @@ This includes linting as well as script, stylesheet and HTML compiling.
4545
Also, a [browsersync](https://browsersync.io/) script will be automatically generated, which will take care of precaching your sites resources.
4646

4747

48-
### Production mode
48+
### Build (production) mode
4949

5050
Serve the Fully Built & Optimized Site
5151

@@ -69,7 +69,7 @@ Included in `gulp` and `gulp build` tasks.
6969
$ gulp fix-js
7070
```
7171

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

7575
## Structure
@@ -100,11 +100,13 @@ If you want to use our WSK, you need to know something about the structure.
100100
├── layout #Global layout
101101
├── pages #Global styles for pages
102102
├── styles.scss #Main scss file (can be used for importing another files)
103-
├── sys_icon #Folder with system icons for notification
103+
├── system_files #Folder with system files
104104
├── tasks #Folder with tasks for gulpfile
105105
├── vendor_entries #Folder for vendor entries (plugins)
106106
├── vendor.js #File for plugins js
107+
├── vendor-compile.js #File for compiling (bunling) plugins js
107108
├── vendor.scss #File for plugins styles
109+
├── .babelrc #Config for Babel
108110
├── .browserslistrc #Config for autoprefixer
109111
├── .editorconfig #Config file for IDE
110112
├── .eslintignore #Eslint ignore list
@@ -152,7 +154,7 @@ So while normal CSS doesn’t yet allow things like variables, mixins (reusable
152154
* All **extensions** must be installed by the [npm](https://docs.npmjs.com/cli/install);
153155
* After installing the extension you must **include** its **css** or **sass** files in `assets/vendor_entries/vendor.scss` using `@import`.
154156

155-
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).
157+
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).
156158
You can see this property `getFilesForStylesCustom` in the `gulp-config.js` file:
157159

158160
![image](https://user-images.githubusercontent.com/38295556/72220657-88b3c400-355b-11ea-90d7-4cbb5edb0f43.png)
@@ -161,15 +163,15 @@ Please don't forget to link all your **styles custom files** in **html** file:
161163

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

164-
Also, you might want to add these sass files to the ignore list (check `getPathesToCopyForProduction` and `getPathesToCopy` properties in the `gulp-config.js` file). By default they will be copied to the `public/css` without grouping css media queries.
166+
Also, you might want to add these sass files to the ignore list (check `getFilesToCopyProd` and `getFilesToCopy` properties in the `gulp-config.js` file). By default they will be copied to the `public/css` without grouping css media queries.
165167

166168
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).
167169

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

170-
In **production** mode we use:
172+
In **build (production)** mode we use:
171173

172-
* **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`.
174+
* **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`.
173175

174176
In our WSK we use **CSS3 custom properties** and **relative units** `rem`. By default `1rem = 10px`.
175177

@@ -179,20 +181,21 @@ In our WSK we use **CSS3 custom properties** and **relative units** `rem`. By de
179181

180182
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.
181183

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

184186
* All custom **javascript** files are located in `js` folder;
185187
* Entry point for javascript is `assets/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;
186188
* All **javascript** is **babelified** so yes! You can use all kind of [ES6 features](https://babeljs.io/docs/learn-es2015/) here.
187189
* All **extensions** must be installed by the [npm](https://docs.npmjs.com/cli/install);
188190
* After installing the extension you must **include** its **javascript** files in `assets/vendor_entries/vendor.js` by adding new elements to the **array**.
191+
* If you using ES modules or any types of modules, please import your modules in `assets/vendor_entries/vendor-compile.js`.
189192

190193
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`.
191194

192195
## Watching
193196

194-
After run `gulp` by default gulp watching for your files in `src` and `assets` folders.
195-
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.
197+
After run `gulp` by default gulp watching for your files in `assets` and `public` folders.
198+
For `js`, `scss`, `html` and `vendors_entries` folders after change in included files, watcher run they tasks for compiling. For other folders and files in `public` watcher reload browser.
196199

197200
## Tasks
198201

gulp-config.js

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,61 @@
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+
browserSync: 'browser-sync',
15+
watch: 'watch',
16+
build: 'build',
17+
},
218
folder: {
319
tasks: 'tasks',
20+
// dev: 'develop',
421
build: 'public',
522
temp: '.temp',
623
},
724
file: {
825
mainHtml: 'index.html',
926
mainJs: 'app.js',
10-
publicJs: 'jquery.main.js',
27+
buildJs: 'jquery.main.js',
1128
vendorJs: 'vendor.js',
29+
vendorJsComp: 'vendor-compile.js',
1230
vendorJsTemp: 'vendor.temp.js',
31+
mainStylesSrc: 'styles.scss',
1332
mainStyles: 'styles.css',
33+
vendorStylesSrc: 'vendor.scss',
1434
vendorStyles: 'vendor.css',
1535
},
1636
buildHtml: {
1737
templates: 'html/templates',
18-
dest: 'public',
1938
},
2039
buildStyles: {
2140
// Sorting type css media queries: 'desktop-first' || 'mobile-first'
2241
sortType: 'desktop-first',
2342
},
24-
task: {
25-
lintHtml: 'lint-html',
26-
lintJs: 'lint-js',
27-
buildHtml: 'build-html',
28-
buildJs: 'build-js',
29-
buildJsVendors: 'build-js-vendors',
30-
buildStyles: 'build-styles',
31-
buildStylesCustom: 'build-styles-custom',
32-
buildStylesVendors: 'build-styles-vendors',
33-
cleanBuild: 'clean-build',
34-
browserSync: 'browser-sync-server',
35-
watch: 'watch',
36-
},
3743
error: {
38-
icon: './sys_icon/error_icon.png',
44+
sound: true,
45+
title: '< SYSTEM ERROR >',
46+
icon: './system_files/icons/error_icon.png',
3947
wait: true,
4048
},
41-
getFilesForStylesCustom: function () {
49+
getFilesForStylesCustom() {
4250
return {
4351
files: [],
4452
isGcmq: false,
4553
};
4654
},
55+
isProduction() {
56+
return process.argv[process.argv.length - 1] === this.task.build;
57+
},
58+
isFixJs() {
59+
return process.argv[process.argv.length - 1] === this.task.fixJs;
60+
}
4761
};

0 commit comments

Comments
 (0)