HTML5 Boilerplate
HTML5 Boilerplate is a professional front-end template for building fast, robust, and adaptable web apps or sites.
This project is the product of over 10 years of iterative development and community knowledge. It does not impose a specific development philosophy or framework, so you're free to architect your code in the way that you want.
- Homepage: https://html5boilerplate.com/
- Source: https://github.com/h5bp/html5-boilerplate
- Twitter: @h5bp
Quick start
Choose one of the following options:
-
Download the latest stable release from html5boilerplate.com. This zip file is a snapshot of the
dist
folder. On Windows, Mac and from the file manager on Linux unzipping this folder will output to a folder named something likehtml5-boilerplate_v7.3.0
. From the command line will need to create a folder and unzip the contents into that folder.mkdir html5-boilerplate unzip html5-boilerplate*.zip -d html5-boilerplate
-
Clone the git repo —
git clone https://github.com/h5bp/html5-boilerplate.git
- and checkout the tagged release you'd like to use. Thedist
folder represents the latest version of the project for end users. -
Install with npm:
npm install html5-boilerplate
or yarn:yarn add html5-boilerplate
. The resultingnode_modules/html5-boilerplate/dist
folder represents the latest version of the project for end users. Depending on what you want to use and how you want to use it, you may have to copy and paste the contents of that folder into your project directory. -
Using the create-html5-boilerplate script, instantly fetch the latest npm published package (or any version available on npm) with
npx
,npm init
oryarn create
without having to install any dependencies. Running the followingnpx
command installs the latest version into a folder callednew-site
npx create-html5-boilerplate new-site cd new-site npm install npm run start
-
Using our new Template Repository create a new GitHub repository based on the latest code from the main branch of HTML5 Boilerplate.
Features
- A finely-tuned starter template. Reap the benefits of 10 years of analysis, research and experimentation by over 200 contributors.
- Designed with progressive enhancement in mind.
- Includes:
Normalize.css
for CSS normalizations and common bug fixes- A custom build of
Modernizr
for feature detection Apache Server Configs
that improve the web site's performance and security
- Placeholder Open Graph elements and attributes.
- An example package.json file with WebPack commands built in to jumpstart application development
- Placeholder CSS Media Queries.
- Useful CSS helper classes.
- Default print styles, performance optimized.
- Protection against any stray
console
statements causing JavaScript errors in older browsers. - "Delete-key friendly." Easy to strip out parts you don't need.
- Extensive documentation.
Browser support
HTML5-Boilerplate supports the latest, stable releases of all major browsers.
You can find our range of supported browsers in our package.json At present we extend the browserlist default with the addition of IE 11 and FireFox ESR.
"browserslist": [
"> 0.5%",
"last 2 versions",
"Firefox ESR",
"not dead",
"IE 11"
],
That configuration translates to this full list of browsers.
Documentation
Take a look at the documentation table of contents. This documentation is bundled with the project which makes it available for offline reading and provides a useful starting point for any documentation you want to write about your project.
Contributing
Hundreds of developers have helped to make the HTML5 Boilerplate. Anyone is welcome to contribute, however, if you decide to get involved, please take a moment to review the guidelines:
License
The code is available under the MIT license.
script loading solution
# This issue thread is now closed. ## It was fun, but the conversations have moved elsewhere for now. Thanks ### In appreciation of the funtimes we had, @rmurphey made us a happy word cloud of the thread.
Enjoy.
via labjs or require.
also how does this play into the expectation of a build script that concatenates and minifies all script? should script loading be an option?
Remove Google CDN reference for jQuery
http://statichtml.com/2011/google-ajax-libraries-caching.html
According to that, there is a very little benefit to using the Google CDN to serve jQuery source. A better option would be to encourage devs to minify and concatenate all of their script files into one JS file served with a long-lived cache time.
This was referenced by Alex Sexton (@SlexAxton) in his talk at jQueryTO March 2nd, 2013.
Drop legacy browser support
IE6 is essentially dead in the Americas and Europe...and increasingly rare in the territories where it is clinging on. IE7 is close to dropping under 2%. Firefox 3.6 is no longer supported by Mozilla. Safari 4 died ages ago.
Going forward, we shouldn't actively support these browsers in the HTML5 Boilerplate project. If in the future someone absolutely needs legacy support for a specific project they are working on, then they can download the last stable release of HTML5 Boilerplate that supports it - it will do the job perfectly well.
Probable changes involved in dropping IE 6/7, Firefox 3.6, Safari 4:
html
tag.Remove IE conditional classes
We should consider their complete removal from the HTML5 Boilerplate template. A good time to do it would be as part of #1050 when IE 6/7 support is dropped for version 5.0.
Reasons:
X-UA-Compatible
meta
tag. See #1187.Hopefully, even "conditional IE class" users will view them as disposable in an IE 8+ development setting. If you need IE 6/7 support, the last 4.* release will still cater to your needs. However, feedback is welcome!
rewrite project css as scss
It'd be better for us to author the styles in scss.
We can still host the css in the repo for newbs that can't be bothered with a
compass compile
stepoverall advantages:
individual advantages
:selection
styles DRYd upinput[type=search]
disadvantages
Drop IE8 support
Microsoft is ending the extended support for Windows XP on April 8, 2014. Since IE8 is mostly a Windows XP browser, and it's market share is slowly but steadily going down¹ , I think we should start the discussion on dropping IE8 support.
¹ Some current estimates (feel free to share your own/other):
Changes involved with dropping IE8 support:
2.x.x
Revert mobile-first media queries and remove respond.js
IE6-8 require respond.js to act as a polyfill because H5BP uses mobile-first media queries.
I'm not convinced mobile-first media queries are best.
What mobile browsers (in use, currently) do not support media queries? Moreover, of the ones who don't, are there browsers that don't scale the content to somehow adapt to the small screen size?
I don't know enough of the Blackberry/Nokia product line to know what's up on this front. But I have a feeling the mobile-first MQ setup is a lot of work. And the payoff is not worth the effort.
A build script is necessary
others: http://daverupert.com/2010/06/web-performant-wordpress/
I'm unsure on how this could be added to the project in a general way.. something php/ruby/py/html folks could all use it.
IE conditional comments around html tag adds Compat View icon to address bar
Even though the doctype is HTML5 recommended and the X-UA-Compatible meta tag is present, by putting the HTML tag in a series of IE conditional comments, IE refuses to believe that the website is indeed "modern" and puts the dreaded "Compatibility View" button in the address bar.
The way I get around this is by using JavaScript to add the ie6/7/whatever classes.
Example:
I'm sure there are better ways to handle this, but this works as expected.
Look into updating .ir to use a "new and improved" method
This article claims that -9999px (or -999em in our case) has noticeable performance issues when running animations on the iPad 1.
The new CSS would be something like:
Also, H5BP has some non-obvious tweaks in the existing
.ir
class that would need to be evaluated if this new method were to be implemented.Move our build script over to Rake
I'm thinking we should move from the Ant build script to something else..
why?
build.xml
is less than sexy.However, what is does is hugely useful.
We're thinking about using Sass and Compass in the build cycle in order to get
@import
inlining for our stylesheet optimization. This introduces a Ruby dependency. (However I will note that I have nearly successfully campaigned a YUI Compressor (which we're currently using) developer to add the@import
inlining feature)So if we need ruby in the build process.. Let's just go for it. Rakefiles are wayyy better and more readable than Ant build files.
Things to be done:
Relevant links:
Guys that are interested in helping (and have experience with Rake):
(alternatively if anyone reading this thinks we should stick with Ant and wants to take the lead on iterating on it... by all means please speak up! :)
sets package to private by default (closes #2887)
Types of changes
Checklist:
Pull requests should be thought of as a conversation. There will be some back and forth when trying to get code merged into this or any other project. With all but the simplest changes you can and should expect that the maintainers of the project will request changes to your code. Please be aware of that and check in after you open your PR in order to get your code merged in cleanly.
Thanks!
[question] How to publish static assets?
I'm submitting a ...
How to I make static assets available on the published website? I want to publish at mywebsite.com/some-image.png so I can use it as an OpenGraph image (which does not allow relative URL).
I tried to create a
public
folder and astatic folder
but they are not copied on build.I feel this info should be in HTML5Boilerplate docs.
Sorry in advance if missed it but I read the docs (I checked the README, Usage, the FAQ Miscellaneous and Extending), I searched Parcel docs, Github Issues issues, SO.
VS Code Integration?
Is there something we can do there? Don't mind me, I'm just looking for interesting stuff to do as I try to amp up my OS contributions over this summer.
Alert on attempt to use Topics API
As multiple third-party scripts might be added to a site during development, it can be difficult to see when a script is attempting to use new browser features that might have privacy consequences.
Consider adding a simple alert so that scripts can be checked and/or the site Permissions-Policy set before deploying to production.
The "alert" is for development purposes, and could be replaced with an analytics event if a site wants to monitor attempted use of Topics API by third parties in production.
Related: https://github.com/h5bp/html5-boilerplate/pull/2459
Types of changes
Checklist:
Pull requests should be thought of as a conversation. There will be some back and forth when trying to get code merged into this or any other project. With all but the simplest changes you can and should expect that the maintainers of the project will request changes to your code. Please be aware of that and check in after you open your PR in order to get your code merged in cleanly.
Thanks!