|
1 | 1 | # Gulp Webpack Starter :octopus: |
| 2 | + |
2 | 3 | [](https://github.com/wwwebman/gulp-webpack-starter/blob/master/CONTRIBUTING.md) |
3 | 4 | [](https://github.com/wwwebman/gulp-webpack-starter/blob/master/CONTRIBUTING.md) |
4 | 5 | []() |
5 | 6 | [](https://travis-ci.org/wwwebman/gulp-webpack-starter) |
6 | 7 | [](https://gitter.im/gulp-webpack-starter/Lobby) |
7 | 8 |
|
8 | | -**Gulp Webpack Starter** - A simple web-development toolkit using Gulp task runner and Webpack bundler. Ideal for building static HTML templates, speeding up [Wordpress](#wordpress) theme development, or any similar template-driven and front-end project. |
| 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. |
9 | 13 |
|
10 | 14 |  |
11 | 15 |
|
12 | 16 | ## List of Content |
| 17 | + |
13 | 18 | 1. [Features](#gift-features) |
14 | 19 | 1. [Getting Started?](#getting-started) |
15 | 20 | * [Recommendations](#closed_book-recommendations) |
16 | | - * [Static templating](#dart-static-templating) |
17 | | - * [Wordpress](#eyes-wordpress) |
| 21 | + * [Static HTML templating](#dart-1-static-html-templating) |
| 22 | + * [Wordpress](#eyes-2-wordpress) |
18 | 23 | 1. [Configuration](#configuration) |
19 | 24 | 1. [Changelog](https://github.com/wwwebman/gulp-webpack-starter/blob/master/CHANGELOG.md) |
20 | 25 | 1. [Contributing](https://github.com/wwwebman/gulp-webpack-starter/blob/master/CONTRIBUTING.md) |
21 | 26 |
|
22 | 27 | ## :gift: Features |
| 28 | + |
23 | 29 | |Features|Description| |
24 | 30 | |------------------|-----------| |
25 | 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)| |
|
32 | 38 | |Deployment| [vinyl-ftp](https://www.npmjs.com/package/vinyl-ftp)| |
33 | 39 |
|
34 | 40 | ## Getting started? |
| 41 | + |
35 | 42 | ### :closed_book: Recommendations |
| 43 | + |
36 | 44 | Make sure you have the following installed: |
37 | 45 | * [Node.js](https://nodejs.org/) |
38 | 46 | * [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/en/) |
39 | 47 |
|
40 | | -**Recommended to use node 8.9.* ([last LTS version](https://github.com/nodejs/Release#release-schedule))** |
41 | | -### :dart: Static templating |
| 48 | +**Recommended to use Node.js >= v10.16.0**. |
| 49 | + |
| 50 | +## :dart: 1. Static HTML templating |
| 51 | + |
42 | 52 | #### Step 1 - clone |
| 53 | + |
43 | 54 | ```bash |
44 | 55 | git clone https://github.com/wwwebman/gulp-webpack-starter <my-project-name> |
45 | 56 | cd <my-project-name> |
46 | 57 | ``` |
| 58 | + |
47 | 59 | #### Step 2 - run |
| 60 | + |
48 | 61 | ```bash |
49 | 62 | yarn |
50 | 63 | yarn start |
51 | 64 | ``` |
52 | | -Easy, right? |
53 | 65 |
|
54 | | -### :eyes: Wordpress |
55 | | -#### Step 1 - install Wordpress |
| 66 | +**Pretty easy, right?** |
| 67 | + |
| 68 | +*** |
| 69 | + |
| 70 | +## :eyes: 2. Wordpress |
| 71 | + |
| 72 | +#### Step 1 - Install Wordpress |
| 73 | + |
56 | 74 | Install Wordpress on you localhost (MAMP, LAMP) |
57 | | -#### Step 2 - create theme |
| 75 | + |
| 76 | +#### Step 2 - Create Wordpress Theme |
| 77 | + |
58 | 78 | `cd` into your theme directory. E.g.: |
| 79 | + |
59 | 80 | ```bash |
60 | | - cd project/wp-content/themes/customTheme/ |
| 81 | + cd project/wp-content/themes/[your_theme_folder] |
61 | 82 | ``` |
62 | | -#### Step 3 - clone starter |
| 83 | + |
| 84 | +#### Step 3 - Clone starter |
| 85 | + |
63 | 86 | ```bash |
64 | | -git clone https://github.com/wwwebman/gulp-webpack-starter frontEnd |
65 | | -cd frontEnd |
| 87 | +git clone https://github.com/wwwebman/gulp-webpack-starter [your_frontend_folder_name] |
| 88 | +cd [your_frontend_folder_name] |
66 | 89 | ``` |
67 | | -#### Step 4 - change config |
68 | | -Certain defaults will need to be changed in **tasks/config.json*** for WP development. |
69 | | -1. Change the global assets output, since we want to export assets to the theme root directory: |
70 | | -```json |
71 | | -"dist": "../" |
| 90 | + |
| 91 | +#### Step 4 - Change config |
| 92 | + |
| 93 | +Edit `./tasks/config.json` file with following instruction: |
| 94 | + |
| 95 | +1. Change the global assets output: |
| 96 | + |
| 97 | +```json |
| 98 | +{ |
| 99 | + "root": { |
| 100 | + "dist": ".." |
| 101 | + } |
| 102 | +} |
72 | 103 | ``` |
73 | | -2. Disable the `html` `run` task, since we don’t need to compile HTML in this project: |
| 104 | + |
| 105 | +Starting from now all compiled files will land to `themes/[your_theme_folder_folder]/assets`. |
| 106 | + |
| 107 | +2. Disable the `html` `run` task, since we don’t need to compile HTML in Wordpress: |
| 108 | + |
74 | 109 | ```json |
75 | | -"html": { |
76 | | - "run": false |
77 | | -}, |
| 110 | +{ |
| 111 | + "html": { |
| 112 | + "run": false |
| 113 | + } |
| 114 | +} |
78 | 115 | ``` |
| 116 | + |
79 | 117 | 3. Now, browserSync should use proxy instead of creating a static server: |
| 118 | + |
80 | 119 | * `target` should refer to the location (`pwd`) of your local WordPress installation |
81 | | - * `publicPath` should refer to the folder to which you’re outputting the `bundle.js` file. The Reason - issue [GWS - 3](https://github.com/wwwebman/gulp-webpack-starter/issues/3) |
| 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 | + |
82 | 123 | ```json |
83 | | - "proxy": { |
84 | | - "target": "localhost/project", |
85 | | - "publicPath" : "http://localhost:3333/project/wp-content/themes/customTheme/dist/assets/js", |
| 124 | +{ |
| 125 | + "proxy": { |
| 126 | + "target": "http://localhost/[your_project]", |
| 127 | + "publicPath" : "http://localhost:3333/[your_project]/wp-content/themes/[your_theme_folder]/assets/js/" |
86 | 128 | } |
| 129 | +} |
87 | 130 | ``` |
| 131 | + |
88 | 132 | #### Step 5 - run |
| 133 | + |
89 | 134 | ```bash |
90 | 135 | yarn |
91 | 136 | yarn start |
92 | 137 | ``` |
93 | 138 |
|
| 139 | +**This is cool, isn't it?** |
| 140 | + |
| 141 | +If you still have a problem, let us know by opening an [issue](https://github.com/wwwebman/gulp-webpack-starter/issues). |
| 142 | + |
94 | 143 | ## Commands |
| 144 | + |
95 | 145 | ```bash |
96 | | -yarn <script> //alternative: npm run <script> |
97 | | -yarn start //Run development mode |
98 | | -yarn build //Compiles your App for production |
99 | | -yarn deploy //Push production version on remote server using FTP |
| 146 | +yarn <script> // alternative: npm run <script> |
| 147 | + |
| 148 | +yarn start // Run development mode |
| 149 | +yarn build // Compiles your App for production |
| 150 | +``` |
| 151 | + |
| 152 | +### Bonus |
| 153 | + |
| 154 | +You can add credentials in `./tasks/config.json` and deploy project using FTP server. |
| 155 | + |
| 156 | + ```json |
| 157 | +{ |
| 158 | + "deploy": { |
| 159 | + "hostname": "", |
| 160 | + "username": "", |
| 161 | + "path": "/", |
| 162 | + "password": "" |
| 163 | + } |
| 164 | +} |
100 | 165 | ``` |
| 166 | + |
| 167 | +Then use the following command: |
| 168 | + |
| 169 | +```bash |
| 170 | +yarn deploy |
| 171 | +``` |
| 172 | + |
| 173 | + |
0 commit comments