You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-8Lines changed: 35 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,9 +85,36 @@ new webpack.ProvidePlugin({
85
85
});
86
86
```
87
87
88
-
## 5. Responsive Image Generation
88
+
## 5. Environment Configurations
89
89
90
-
### 5.1 What is it?
90
+
If you use sensitive information in your code, like API keys or encryption tokens, you should never store those in your code repository. This can could lead to a security issue, especially if the repository is public.
91
+
92
+
Therefore I included the [dotenv-webpack](https://github.com/mrsteele/dotenv-webpack) plugin in this boilerplate, that enables you to store all your sensitive information in a `.env` file, that is ignored by git.
93
+
94
+
The `.env.default` file should contain all the variables that your application needs, but without the real data and should contain either empty variables or default values that can be used by everyone. The variables will get replaced during asset compilation so that only those variables are added, that are referenced in your code.
95
+
96
+
It is a common scheme to use an uppercase syntax for environment variables, as you can see in the example below. Comments inside of .env files start with a hash.
You can test the usage of environment variables by copying the `.env.default` file to a new `.env` file and changing the value of `HELLO`. After re-compiling the assets you should see a message in the developer console, as soon as you visit the demo page.
110
+
111
+
**Important:**
112
+
113
+
After each change of the `.env` file you need to reload Webpack, as the environment is only loaded once per runtime. If you've got an active `npm run dev` command, you need to stop and re-run it, for the changes to take effect.
114
+
115
+
## 6. Responsive Image Generation
116
+
117
+
### 6.1 What is it?
91
118
92
119
This boilerplate includes a command to resize images based on a configuration file, to get rid of the hassle to care about the responsive image sizes manually. One of the benefits of this process is that it works on all major operating systems, without the need to do any manual installations.
93
120
@@ -165,11 +192,11 @@ All files that are listed should get renamed, following the rules you can see in
165
192
166
193
---
167
194
168
-
### 5.2 The Configuration
195
+
### 6.2 The Configuration
169
196
170
197
The responsive image configuration is saved in the `images.config.js` file, located in the root directory of the project.
171
198
172
-
#### 5.2.1 Global Settings
199
+
#### 6.2.1 Global Settings
173
200
174
201
The configuration has some global settings, that you should set to your personal preferences.
175
202
@@ -190,7 +217,7 @@ The configuration has some global settings, that you should set to your personal
190
217
</tbody>
191
218
</table>
192
219
193
-
#### 5.2.2 Collections
220
+
#### 6.2.2 Collections
194
221
195
222
The configuration uses **collections** which include a set of configuration options to resize images. This allows you to define different resizing rules for multiple directories.
196
223
@@ -233,7 +260,7 @@ Each collection has the following options.
233
260
</tbody>
234
261
</table>
235
262
236
-
#### 5.2.3 Sizes
263
+
#### 6.2.3 Sizes
237
264
238
265
Each collection has the option "sizes" which includes a set of configurations for different image sizes that will be generated. Width and height are optional, if at least one of them is set.
239
266
@@ -292,7 +319,7 @@ Each size has the following options.
292
319
293
320
---
294
321
295
-
### 5.3 The Command Line Arguments
322
+
### 6.3 The Command Line Arguments
296
323
297
324
The resizing command supports different arguments to remove resized images, recreate all images, etc.
298
325
@@ -329,7 +356,7 @@ npm run images remove
329
356
330
357
---
331
358
332
-
## 6. Placeholder Images
359
+
## 7. Placeholder Images
333
360
334
361
All placeholder images used in the `index.html` file are downloaded from [pexels.com](https://www.pexels.com/), and [pixabay.com](https://pixabay.com/). Those are two fantastic collections of free stock photos from photographers around the globe.
0 commit comments