Skip to content

Commit 91d1356

Browse files
authored
Merge pull request #53 from wwwebman/release/v2.0.0
Release/v2.0.0
2 parents b95a395 + eac7abf commit 91d1356

File tree

118 files changed

+3058
-4881
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+3058
-4881
lines changed

.babelrc

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

.browserslistrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
last 3 versions
2+
> 2%

.env.dist

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
CLEAN_FILES_OUTSIDE_WORKING_DIR=true
2+
3+
ROOT_DEV=./dev
4+
ROOT_DIST=./dist
5+
6+
HTML_DEV=html
7+
HTML_DIST=./
8+
HTML_PARTS=templates
9+
HTML_RUN=true
10+
11+
CSS_DEV=sass
12+
CSS_DIST=assets/css
13+
CSS_EXTENTIONS=*.+(css|scss)
14+
CSS_PURGE=false
15+
CSS_PURGE_WHITELIST=active,in,opened
16+
CSS_PURGE_CONTENT=./dev/html/**/*.html
17+
18+
JS_DEV=js
19+
JS_DIST=assets/js
20+
21+
IMAGES_DEV=images/**/
22+
IMAGES_DIST=assets/images
23+
IMAGES_EXTENTIONS=*.+(jpg|jpeg|gif|png|svg)
24+
25+
SVG_SPRITE_DEV=images/sprite
26+
SVG_SPRITE_DIST=assets/sprite
27+
28+
FONTS_DEV=fonts
29+
FONTS_DIST=assets/fonts
30+
FONTS_EXTENTIONS=*.+(woff2|woff|eot|ttf|svg)
31+
32+
STATIC_DEV=static
33+
STATIC_DIST=assets/static
34+
35+
BROWSER_SYNC_PORT=3333
36+
BROWSER_SYNC_TARGET=
37+
BROWSER_SYNC_PUBLIC_PATH=
38+
BROWSER_SYNC_FILES=

.env.wordpress

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
CLEAN_FILES_OUTSIDE_WORKING_DIR=true
2+
3+
ROOT_DEV=./dev
4+
ROOT_DIST=..
5+
6+
HTML_DEV=html
7+
HTML_DIST=./
8+
HTML_PARTS=templates
9+
HTML_RUN=false
10+
11+
CSS_DEV=sass
12+
CSS_DIST=assets/css
13+
CSS_EXTENTIONS=*.+(css|scss)
14+
CSS_PURGE=false
15+
CSS_PURGE_WHITELIST=active,in,opened
16+
CSS_PURGE_CONTENT=../**/*.php
17+
18+
JS_DEV=js
19+
JS_DIST=assets/js
20+
21+
IMAGES_DEV=images/**/
22+
IMAGES_DIST=assets/images
23+
IMAGES_EXTENTIONS=*.+(jpg|jpeg|gif|png|svg)
24+
25+
SVG_SPRITE_DEV=images/sprite
26+
SVG_SPRITE_DIST=assets/sprite
27+
28+
FONTS_DEV=fonts
29+
FONTS_DIST=assets/fonts
30+
FONTS_EXTENTIONS=*.+(woff2|woff|eot|ttf|svg)
31+
32+
STATIC_DEV=static
33+
STATIC_DIST=assets/static
34+
35+
BROWSER_SYNC_PORT=3333
36+
BROWSER_SYNC_TARGET=http://localhost/[awesome_wp_project]/
37+
BROWSER_SYNC_PUBLIC_PATH=http://localhost:3333/[awesome_wp_project]/wp-content/themes/[theme_folder_name]/assets/js/
38+
BROWSER_SYNC_FILES=*.php

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
bower_components
21
node_modules
32
assets
43
dist
@@ -7,3 +6,4 @@ npm-debug.log
76
/*.html
87
.DS_Store
98
.idea
9+
.env

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
language: node_js
22
node_js:
3-
- "10.16.0"
3+
- "10.16.0"
44
before_script:
5-
# starting a GUI to run tests, per https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI
6-
- export DISPLAY=:99.0
7-
- sh -e /etc/init.d/xvfb start
5+
- cp .env.dist .env
6+
install:
7+
- yarn install
88
script:
9-
- "npm run build"
9+
- yarn build
1010
os:
11-
- linux
12-
- windows
11+
- linux
12+
- osx

CHANGELOG.md

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

README.md

Lines changed: 63 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,118 @@
1-
# Gulp Webpack Starter :octopus:
1+
<div align="center">
2+
<img alt="styled-components" src="https://user-images.githubusercontent.com/13425833/73493741-a2eefe00-43b3-11ea-8cae-202e646582ac.png" height="150px" />
3+
<br />
4+
<h1>Gulp Webpack Starter</h1>
5+
<a href="https://github.com/wwwebman/gulp-webpack-starter/blob/master/CONTRIBUTING.md"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="Contributions"></a>
6+
<a href="https://github.com/wwwebman/gulp-webpack-starter/blob/master/CONTRIBUTING.md"><img src="https://img.shields.io/github/contributors/wwwebman/gulp-webpack-starter.svg" alt="Contributors"></a>
7+
<a href="https://github.com/wwwebman/gulp-webpack-starter/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg" alt="License"></a>
8+
<a href="https://travis-ci.org/wwwebman/gulp-webpack-starter"><img src="https://travis-ci.org/wwwebman/gulp-webpack-starter.svg?branch=master" alt="Travis CI"></a>
9+
<a href="https://gitter.im/gulp-webpack-starter/Lobby"><img src="https://img.shields.io/gitter/room/tj/git-extras.svg?style=flat-square" alt="Gitter Chat"></a>
10+
</div>
211

3-
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/wwwebman/gulp-webpack-starter/blob/master/CONTRIBUTING.md)
4-
[![GitHub contributors](https://img.shields.io/github/contributors/wwwebman/gulp-webpack-starter.svg)](https://github.com/wwwebman/gulp-webpack-starter/blob/master/CONTRIBUTING.md)
5-
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)]()
6-
[![Build Status](https://travis-ci.org/wwwebman/gulp-webpack-starter.svg?branch=master)](https://travis-ci.org/wwwebman/gulp-webpack-starter)
7-
[![Gitter](https://img.shields.io/gitter/room/tj/git-extras.svg?style=flat-square)](https://gitter.im/gulp-webpack-starter/Lobby)
12+
<br />
813

9-
**Gulp Webpack Starter** - A simple web-development toolkit using Gulp task runner and Webpack bundler.
10-
Ideal for [building static HTML templates](#dart-1-static-html-templating)
11-
or [speeding up Wordpress](#eyes-2-wordpress) theme development
12-
and any similar template-driven and front-end project.
14+
**Gulp Webpack Starter** - fast and simple web development toolkit.
15+
It uses Gulp task runner and Webpack bundler.
16+
The starter perfectly fits [building static HTML templates](#dart-1-static-html-templating)
17+
or [speeding up WordPress](#eyes-2-wordpress) theme development.
1318

14-
![Gulp Webpack Starter](http://webman.pro/assets/img/main/gulp-webpack-starter-webman.jpg)
19+
[Version 2](https://github.com/wwwebman/gulp-webpack-starter/releases/tag/v2.0.0) is released :tada:.
20+
21+
**Easy to start, nice to use. Check it out! :octopus:**
22+
___
1523

1624
## List of Content
1725

1826
1. [Features](#gift-features)
1927
1. [Getting Started?](#getting-started)
2028
* [Recommendations](#closed_book-recommendations)
2129
* [Static HTML templating](#dart-1-static-html-templating)
22-
* [Wordpress](#eyes-2-wordpress)
23-
1. [Configuration](#configuration)
24-
1. [Changelog](https://github.com/wwwebman/gulp-webpack-starter/blob/master/CHANGELOG.md)
25-
1. [Contributing](https://github.com/wwwebman/gulp-webpack-starter/blob/master/CONTRIBUTING.md)
30+
* [WordPress](#eyes-2-wordpress)
31+
1. [Contributing](./CONTRIBUTING.md)
32+
1. [Examples](./examples)
2633

2734
## :gift: Features
2835

2936
|Features|Description|
3037
|------------------|-----------|
31-
|CSS| [SASS](http://sass-lang.com/), [SMACSS](https://smacss.com/), [Autoprefixer](https://github.com/postcss/autoprefixer), [clean-css](https://www.npmjs.com/package/gulp-clean-css)|
38+
|CSS| [SASS](http://sass-lang.com/), [Autoprefixer](https://github.com/postcss/autoprefixer), [gulp-purgecss](https://www.npmjs.com/package/gulp-purgecss)|
3239
|JS|[Webpack](https://webpack.js.org/), [Babel](http://babeljs.io/)|
33-
|Testing|[Jest](https://facebook.github.io/jest/)|
3440
|Live Reload|[BrowserSync](http://www.browsersync.io/), [Webpack Dev Middleware](https://github.com/webpack/webpack-dev-middleware), [Webpack Hot Middleware](https://github.com/glenjamin/webpack-hot-middleware)|
3541
|HTML| [gulp-file-include](https://www.npmjs.com/package/gulp-file-include)|
3642
|Images| [gulp-imagemin](https://www.npmjs.com/package/gulp-imagemin)|
3743
|SVG sprite| [gulp-svg-sprite](https://github.com/jkphl/gulp-svg-sprite)|
38-
|Deployment| [vinyl-ftp](https://www.npmjs.com/package/vinyl-ftp)|
3944

4045
## Getting started?
4146

4247
### :closed_book: Recommendations
4348

44-
Make sure you have the following installed:
45-
* [Node.js](https://nodejs.org/)
46-
* [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/en/)
47-
48-
**Recommended to use Node.js >= v10.16.0**.
49+
Make sure you have installed the following:
50+
* [Node.js](https://nodejs.org/)(**Recommended to use Node.js >= v10.16.0**)
51+
* [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/en/).
52+
In this tutorial we use yarn, but you can use npm.
4953

5054
## :dart: 1. Static HTML templating
5155

5256
#### Step 1 - clone
5357

5458
```bash
55-
git clone https://github.com/wwwebman/gulp-webpack-starter <my-project-name>
56-
cd <my-project-name>
59+
git clone https://github.com/wwwebman/gulp-webpack-starter [my-static-template-project-name]
60+
cd [my-static-template-project-name]
5761
```
5862

5963
#### Step 2 - run
6064

65+
`cp .env.dist .env`
66+
6167
```bash
6268
yarn
6369
yarn start
6470
```
6571

66-
**Pretty easy, right?**
67-
68-
***
72+
Start files modification under `[my-static-template-project-name]/dev/*` to feel a great
73+
development experience.
6974

70-
## :eyes: 2. Wordpress
75+
**Cool and pretty easy, right?**
7176

72-
#### Step 1 - Install Wordpress
77+
***
7378

74-
Install Wordpress on you localhost (MAMP, LAMP)
79+
## :eyes: 2. WordPress
7580

76-
#### Step 2 - Create Wordpress Theme
81+
### 1. Preparation
7782

78-
`cd` into your theme directory. E.g.:
83+
It can be setup in a number of different ways, but we would like to describe the simplest:
7984

80-
```bash
81-
cd project/wp-content/themes/[your_theme_folder_name]
82-
```
85+
Please be sure of the following:
86+
- WordPress website is available under `http://localhost/[awesome_wp_project]`
87+
- WordPress Theme exists
8388

84-
#### Step 3 - Clone starter
89+
Note: folder naming on different OS can differ.
8590

8691
```bash
87-
git clone https://github.com/wwwebman/gulp-webpack-starter [your_frontend_folder_name]
88-
cd [your_frontend_folder_name]
89-
```
92+
cd [awesome_wp_project]/wp-content/themes/[theme_folder_name]
9093

91-
#### Step 4 - Change config
94+
git clone [email protected]:wwwebman/gulp-webpack-starter.git [frontend_folder_name]
9295

93-
Edit `./tasks/config.json` file with following instruction:
96+
cd [frontend_folder_name]
9497

95-
1. Change the global assets output:
96-
97-
```json
98-
{
99-
"root": {
100-
"dist": ".."
101-
}
102-
}
98+
cp .env.wordpress .env
10399
```
104100

105-
Starting from now all compiled files will land to `themes/[your_theme_folder_name_folder]/assets`.
101+
### 2. Modify .env
106102

107-
2. Disable the `html` `run` task, since we don’t need to compile HTML in Wordpress:
103+
##### Required
108104

109-
```json
110-
{
111-
"html": {
112-
"run": false
113-
}
114-
}
115-
```
105+
Set correct values to `BROWSER_SYNC_TARGET` and `BROWSER_SYNC_PUBLIC_PATH` variables.
116106

117-
3. Now, browserSync should use proxy instead of creating a static server:
107+
- `BROWSER_SYNC_TARGET` - refers to WordPress website installed locally
108+
- `BROWSER_SYNC_PUBLIC_PATH` - refers to the relative pathname of `bundle.js` in the browser.
118109

119-
* `target` should refer to the location (`pwd`) of your local WordPress installation
120-
* `publicPath` should refer to the folder to which you’re outputting the `bundle.js` file.
121-
The Reason - issue [GWS - 3](https://github.com/wwwebman/gulp-webpack-starter/issues/3).
122-
123-
```json
124-
{
125-
"proxy": {
126-
"target": "http://localhost/[your_project]",
127-
"publicPath" : "http://localhost:3333/[your_project]/wp-content/themes/[your_theme_folder_name]/assets/js/"
128-
}
129-
}
130-
```
110+
##### Not required
131111

132-
4. Double check if you attached assets in `[your_theme_folder_name]/functions.php`:
112+
All compiled files land to `themes/[theme_folder_name_folder]/assets`.
113+
Modify `ROOT_DIST` to change the destination.
114+
115+
### 3. Double check if assets attached in `[theme_folder_name]/functions.php`:
133116

134117
```php
135118
function enqueue_styles()
@@ -147,12 +130,10 @@ function register_scripts()
147130
add_action('wp_enqueue_scripts', 'register_scripts');
148131
```
149132

150-
#### Step 5 - run
151-
152-
In `[your_theme_folder_name]/[your_frontend_folder_name]`
153-
133+
#### 4. Run
154134

155135
```bash
136+
cd [theme_folder_name]/[frontend_folder_name]
156137
yarn
157138
yarn start
158139
```
@@ -164,31 +145,11 @@ If you still have a problem, let us know by opening an [issue](https://github.co
164145
## Commands
165146

166147
```bash
167-
yarn <script> // alternative: npm run <script>
168-
169-
yarn start // Run development mode
170-
yarn build // Compiles your App for production
171-
```
172-
173-
### Bonus
174-
175-
You can add credentials in `./tasks/config.json` and deploy project using FTP server.
176-
177-
```json
178-
{
179-
"deploy": {
180-
"hostname": "",
181-
"username": "",
182-
"path": "/",
183-
"password": ""
184-
}
185-
}
186-
```
187-
188-
Then use the following command:
189-
190-
```bash
191-
yarn deploy
148+
yarn start // Runs development mode
149+
yarn build // Compiles assets in production mode
192150
```
193151

152+
## License
194153

154+
MIT License, Copyright © 2015-present, [Dmytro Chumak](https://webman.pro/about).
155+
See [LICENSE](./LICENSE) for more information.

0 commit comments

Comments
 (0)