13
Like JS and CSS, HTML can also be "minified":
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<h1>Hello, world!</h1>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
viraria:
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Bootstrap 101 Template</title><link href="css/bootstrap.min.css" rel="stylesheet"><!--[if lt IE 9]><script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script><script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]--></head><body><h1>Hello, world!</h1><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><script src="js/bootstrap.min.js"></script></body></html>
Example HTML taken from here: http://getbootstrap.com/getting-started/
Ministayed here: http://www.willpeavy.com/minifier/
This reduces the size a little and should decrease the download time.
My question is: Is it safe? Or is there a risk of the browser interpreting something wrong? (mainly browsers old as IE<9)
+1 Good answer. Also has the Reactjs facebook... which impressed me a lot!
– Miguel Angelo
Rocha and @Miguel. I was earlier taking a look at interactive tutorial of Knockout JS. His proposal is the same of Angularjs or Angular is still different?
– user7261
For those interested in MVC frameworks: http://todomvc.com/
– Miguel Angelo
@Andrey’s proposal is different knockoutJS has as main functionality to provide an idea of MVVM, ie concept of Viewmodel on a page. However, Angularjs is a complete framework, where you can structure your entire application in it using the concept of MVC. It tbm provides MVVM and data-bind which is where the knockout works, so sometimes they get confused. Take a read in that post, he explains some clear differences between the 2. In short Angularjs is much more complete than Knockout.
– rochasdv