Skip to content
Permalink
Newer
Older
100644 178 lines (128 sloc) 7 KB
Oct 31, 2016
1
[HTML5 Boilerplate homepage](https://html5boilerplate.com) | [Documentation
2
table of contents](TOC.md)
3
4
# Miscellaneous
5
6
* [.gitignore](#gitignore)
7
* [.editorconfig](#editorconfig)
8
* [Server Configuration](#server-configuration)
9
* [crossdomain.xml](#crossdomainxml)
10
* [robots.txt](#robotstxt)
11
* [browserconfig.xml](#browserconfigxml)
12
13
--
14
15
## .gitignore
16
17
HTML5 Boilerplate includes a basic project-level `.gitignore`. This should
18
primarily be used to avoid certain project-level files and directories from
19
being kept under source control. Different development-environments will
20
benefit from different collections of ignores.
21
22
OS-specific and editor-specific files should be ignored using a "global
23
ignore" that applies to all repositories on your system.
24
25
For example, add the following to your `~/.gitconfig`, where the `.gitignore`
26
in your HOME directory contains the files and directories you'd like to
27
globally ignore:
28
29
```gitignore
30
[core]
31
excludesfile = ~/.gitignore
32
```
33
34
* More on global ignores: https://help.github.com/articles/ignoring-files
35
* Comprehensive set of ignores on GitHub: https://github.com/github/gitignore
36
37
38
## .editorconfig
39
40
The `.editorconfig` file is provided in order to encourage and help you and
41
your team define and maintain consistent coding styles between different
42
editors and IDEs.
43
44
By default, `.editorconfig` includes some basic
45
[properties](http://editorconfig.org/#supported-properties) that reflect the
46
coding styles from the files provided by default, but you can easily change
47
them to better suit your needs.
48
49
In order for your editor/IDE to apply the
50
[properties](http://editorconfig.org/#supported-properties) from the
51
`.editorconfig` file, you will need to [install a
52
plugin]( http://editorconfig.org/#download).
53
54
__N.B.__ If you aren't using the server configurations provided by HTML5
55
Boilerplate, we highly encourage you to configure your server to block
56
access to `.editorconfig` files, as they can disclose sensitive information!
57
58
For more details, please refer to the [EditorConfig
59
project](http://editorconfig.org/).
60
61
62
## Server Configuration
63
64
H5BP includes a [`.htaccess`](#htaccess) file for the [Apache HTTP
65
server](https://httpd.apache.org/docs/). If you are not using Apache
66
as your web server, then you are encouraged to download a
67
[server configuration](https://github.com/h5bp/server-configs) that
68
corresponds to your web server and environment.
69
70
A `.htaccess` (hypertext access) file is a [Apache HTTP server
71
configuration file](https://github.com/h5bp/server-configs-apache).
72
The `.htaccess` file is mostly used for:
73
74
* Rewriting URLs
75
* Controlling cache
76
* Authentication
77
* Server-side includes
78
* Redirects
79
* Gzipping
80
81
If you have access to the main server configuration file (usually called
82
`httpd.conf`), you should add the logic from the `.htaccess` file in, for
83
example, a <Directory> section in the main configuration file. This is usually
84
the recommended way, as using .htaccess files slows down Apache!
85
86
To enable Apache modules locally, please see:
87
https://github.com/h5bp/server-configs-apache/wiki/How-to-enable-Apache-modules.
88
89
In the repo the `.htaccess` is used for:
90
91
* Allowing cross-origin access to web fonts
92
* CORS header for images when browsers request it
93
* Enable `404.html` as 404 error document
94
* Making the website experience better for IE users better
95
* Media UTF-8 as character encoding for `text/html` and `text/plain`
96
* Enabling the rewrite URLs engine
97
* Forcing or removing the `www.` at the begin of a URL
98
* It blocks access to directories without a default document
99
* It blocks access to files that can expose sensitive information.
100
* It reduces MIME type security risks
101
* It forces compressing (gzipping)
102
* It tells the browser whether they should request a specific file from the
103
server or whether they should grab it from the browser's cache
104
105
When using `.htaccess` we recommend reading all inline comments (the rules after
106
a `#`) in the file once. There is a bunch of optional stuff in it.
107
108
If you want to know more about the `.htaccess` file check out the
109
[Apache HTTP server docs](https://httpd.apache.org/docs/) or more
110
specifically the [htaccess
111
section](https://httpd.apache.org/docs/current/howto/htaccess.html).
112
113
Notice that the original repo for the `.htaccess` file is [this
114
one](https://github.com/h5bp/server-configs-apache).
115
116
117
## crossdomain.xml
118
119
The _cross-domain policy file_ is an XML document that gives a web client —
120
such as Adobe Flash Player, Adobe Reader, etc. — permission to handle data
121
across multiple domains, by:
122
123
* granting read access to data
124
* permitting the client to include custom headers in cross-domain requests
125
* granting permissions for socket-based connections
126
127
__e.g.__ If a client hosts content from a particular source domain and that
128
content makes requests directed towards a domain other than its own, the remote
129
domain would need to host a cross-domain policy file in order to grant access
130
to the source domain and allow the client to continue with the transaction.
131
132
For more in-depth information, please see Adobe's [cross-domain policy file
133
specification](https://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html).
134
135
136
## robots.txt
137
138
The `robots.txt` file is used to give instructions to web robots on what can
139
be crawled from the website.
140
141
By default, the file provided by this project includes the next two lines:
142
143
* `User-agent: *` - the following rules apply to all web robots
144
* `Disallow:` - everything on the website is allowed to be crawled
145
146
If you want to disallow certain pages you will need to specify the path in a
147
`Disallow` directive (e.g.: `Disallow: /path`) or, if you want to disallow
148
crawling of all content, use `Disallow: /`.
149
150
The `/robots.txt` file is not intended for access control, so don't try to
151
use it as such. Think of it as a "No Entry" sign, rather than a locked door.
152
URLs disallowed by the `robots.txt` file might still be indexed without being
153
crawled, and the content from within the `robots.txt` file can be viewed by
154
anyone, potentially disclosing the location of your private content! So, if
155
you want to block access to private content, use proper authentication instead.
156
157
For more information about `robots.txt`, please see:
158
159
* [robotstxt.org](http://www.robotstxt.org/)
160
* [How Google handles the `robots.txt` file](https://developers.google.com/webmasters/control-crawl-index/docs/robots_txt)
161
162
163
## browserconfig.xml
164
165
The `browserconfig.xml` file is used to customize the tile displayed when users
166
pin your site to the Windows 8.1 start screen. In there you can define custom
167
tile colors, custom images or even [live tiles](https://msdn.microsoft.com/en-us/library/ie/dn455106.aspx#CreatingLiveTiles).
168
169
By default, the file points to 2 placeholder tile images:
170
171
* `tile.png` (558x558px): used for `Small`, `Medium` and `Large` tiles.
172
This image resizes automatically when necessary.
173
* `tile-wide.png` (558x270px): user for `Wide` tiles.
174
175
Notice that IE11 uses the same images when adding a site to the `favorites`.
176
177
For more in-depth information about the `browserconfig.xml` file, please
178
see [MSDN](https://msdn.microsoft.com/en-us/library/ie/dn320426.aspx).
You can’t perform that action at this time.