1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-30 18:24:35 +01:00

Fix output of HTML minifier

This commit is contained in:
squidfunk 2016-12-29 10:27:25 +01:00
parent 584a59ef8b
commit acece94694
5 changed files with 15 additions and 61 deletions

View File

@ -40,10 +40,13 @@ export default (gulp, config, args) => {
.pipe( .pipe(
minhtml({ minhtml({
collapseBooleanAttributes: true, collapseBooleanAttributes: true,
customAttrCollapse: /(content)/,
includeAutoGeneratedTags: false,
minifyCSS: true,
minifyJS: true,
removeComments: true, removeComments: true,
removeScriptTypeAttributes: true, removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true, removeStyleLinkTypeAttributes: true
customAttrCollapse: /(content)/
})) }))
.pipe(replace("$theme-name$", metadata.name)) .pipe(replace("$theme-name$", metadata.name))
.pipe(replace("$theme-version$", metadata.version)) .pipe(replace("$theme-version$", metadata.version))

View File

@ -111,57 +111,15 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<script src="{{ base_url }}/assets/javascripts/application-7f2d08a2e5.js"></script> <script src="{{ base_url }}/assets/javascripts/application-7f2d08a2e5.js"></script>
<script> <script>var config={url:{base:"{{ base_url }}"}},app=new Application(config);app.initialize()</script>
/* Configuration for application */
var config = {
url: {
base: "{{ base_url }}",
}
};
/* Initialize application */
var app = new Application(config);
app.initialize();
</script>
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}
{% block analytics %} {% block analytics %}
{% if config.google_analytics %} {% if config.google_analytics %}
<script> <script>!function(e,t,a,n,o,c,i){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,c=t.createElement(a),i=t.getElementsByTagName(a)[0],c.async=1,c.src=n,i.parentNode.insertBefore(c,i)}(window,document,"script","https://www.google-analytics.com/analytics.js","ga"),ga("create","{{ config.google_analytics[0] }}","{{ config.google_analytics[1] }}"),ga("set","anonymizeIp",!0),ga("send","pageview");var links=document.getElementsByTagName("a");Array.prototype.map.call(links,function(e){e.host!=document.location.host&&e.addEventListener("click",function(){var t=e.getAttribute("data-md-action")||"follow";ga("send","event","outbound",t,e.href)})});var query=document.forms.search.query;query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}})</script>
(function(i,s,o,g,r,a,m){
i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||
[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;
m.parentNode.insertBefore(a,m)
})(window, document,
"script", "https://www.google-analytics.com/analytics.js", "ga");
/* General initialization */
ga("create",
"{{ config.google_analytics[0] }}",
"{{ config.google_analytics[1] }}");
ga("set", "anonymizeIp", true);
ga("send", "pageview");
/* Track outbound links */
var links = document.getElementsByTagName("a");
Array.prototype.map.call(links, function(item) {
if (item.host != document.location.host) {
item.addEventListener("click", function() {
var action = item.getAttribute("data-md-action") || "follow";
ga("send", "event", "outbound", action, item.href);
});
}
});
/* Register handler to log search on blur */
var query = document.forms.search.query;
query.addEventListener("blur", function() {
if (this.value) {
var path = document.location.pathname;
ga("send", "pageview", path + "?q=" + this.value);
}
});
</script>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
</body> </body>
</body></html> </html>

View File

@ -3,14 +3,7 @@
{% set code = config.extra.get("font", {}).code | default("Roboto Mono") %} {% set code = config.extra.get("font", {}).code | default("Roboto Mono") %}
{% set font = text + ':300,400,400i,700|' + code | replace(' ', '+') %} {% set font = text + ':300,400,400i,700|' + code | replace(' ', '+') %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{ font }}"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{ font }}">
<style> <style>body,input{font-family:"{{ text }}","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"{{ code }}","Courier New",Courier,monospace}</style>
body, input {
font-family: "{{ text }}", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
pre, code, kbd {
font-family: "{{ code }}", "Courier New", Courier, monospace;
}
</style>
{% endif %} {% endif %}
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
{% if config.extra.social %} {% if config.extra.social %}

View File

@ -46,9 +46,9 @@
{% endif %} {% endif %}
powered by powered by
<a href="http://www.mkdocs.org">MkDocs</a> <a href="http://www.mkdocs.org">MkDocs</a>
and the and
<a href="http://squidfunk.github.io/mkdocs-material/">Material</a> <a href="http://squidfunk.github.io/mkdocs-material/">
theme Material for MkDocs</a>
</div> </div>
{% if config.extra.social %} {% if config.extra.social %}
<div class="md-footer-social"> <div class="md-footer-social">

View File

@ -85,9 +85,9 @@
{% endif %} {% endif %}
powered by powered by
<a href="http://www.mkdocs.org">MkDocs</a> <a href="http://www.mkdocs.org">MkDocs</a>
and the and
<a href="http://squidfunk.github.io/mkdocs-material/">Material</a> <a href="http://squidfunk.github.io/mkdocs-material/">
theme Material for MkDocs</a>
</div> </div>
<!-- Link to social media accounts, if any --> <!-- Link to social media accounts, if any -->