Skip to content

Commit b1d8727

Browse files
committed
Configure HTML Inspector and analytics.js
1 parent 8a44b1b commit b1d8727

File tree

8 files changed

+47
-48
lines changed

8 files changed

+47
-48
lines changed

assets/javascript/analytics.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ var parseUrl = require('./parse-url');
55

66

77
var breakpoints = {
8-
xs: '(max-width: 419px)',
9-
sm: '(min-width: 420px) and (max-width: 569px)',
10-
md: '(min-width: 570px) and (max-width: 799px)',
11-
lg: '(min-width: 800px) and (max-width: 999px)',
12-
xl: '(min-width: 1000px)'
8+
xs: '(max-width: 383px)',
9+
sm: '(min-width: 384px) and (max-width: 575px)',
10+
md: '(min-width: 576px) and (max-width: 767px)',
11+
lg: '(min-width: 768px)'
1312
};
1413

1514

demos/sticky-footer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ View the full [source](https://github.com/philipwalton/solved-by-flexbox/blob/ma
5151

5252
</div>
5353

54-
<script>
54+
<script class="js-allow-before-footer">
5555
(function() {
5656
var collapseTrigger = document.getElementById("collapse-trigger");
5757
var collapseableContent = document.getElementById("collapsable-content");

templates/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="Footer-credits">
77
<span class="Footer-credit">Created and maintained by <a href="http://philipwalton.com">Philip Walton</a>.</span>
88

9-
<span class="Footer-credit">Source code and examples released under the <a href="https://github.com/philipwalton/solved-by-flexbox/blob/master/LICENSE-MIT">MIT</a> license</span>
9+
<span class="Footer-credit">Source code and examples released under the <a href="https://github.com/philipwalton/solved-by-flexbox/blob/master/LICENSE-MIT">MIT</a> license.</span>
1010

1111
<span class="Footer-credit">Website and documentation licensed under <a href="http://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.</span>
1212
</div>

templates/google-analytics.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% if env == 'dev' %}
2+
<script async src="//www.google-analytics.com/analytics_debug.js"></script>
3+
{% else %}
4+
<script async src="//www.google-analytics.com/analytics.js"></script>
5+
{% endif %}

templates/head.html

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,24 @@
1212
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
1313
<link href="/main.css" rel="stylesheet" type="text/css">
1414

15-
<script class="js-allow-in-head" src="//use.typekit.net/txx2jfv.js"></script>
16-
<script class="js-allow-in-head">try{Typekit.load();}catch(e){}</script>
15+
<script class="js-allow-before-footer" src="//use.typekit.net/txx2jfv.js"></script>
16+
<script class="js-allow-before-footer">try{Typekit.load();}catch(e){}</script>
1717

18-
19-
<script id="ga-setup">
18+
<script class="js-allow-before-footer">
2019
// Google Analytics async snippet:
2120
// http://goo.gl/3FPNDx
2221
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
22+
ga('create', 'UA-21292978-1', 'auto');
2323

24-
// In non-production mode, simply log GA hits to the console.
25-
// Note, tasks must be set before sending the first hit
26-
ga(function(tracker) {
27-
tracker.set('sendHitTask', function() {
28-
// Throw to stop subsequent tasks.
29-
throw 'Abort tracking in non-production environments.'
24+
{% if env == 'dev' %}
25+
// In non-production mode, simply log GA hits to the console.
26+
// Note, tasks must be set before sending the first hit
27+
ga(function(tracker) {
28+
tracker.set('sendHitTask', function() {
29+
// Throw to stop subsequent tasks.
30+
throw 'Abort tracking in non-production environments.'
31+
});
3032
});
31-
});
32-
33-
// Create the GA tracker before doing any logging.
34-
ga('create', 'UA-21292978-1', 'auto');
33+
{% endif %}
3534
</script>
36-
37-
<script async src="//www.google-analytics.com/analytics-debug.js"></script>
38-
3935
</head>

templates/header.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@ <h1 class="Header-title"><a href="/">Solved <i>by</i> Flexbox</a></h1>
33
<h2 class="Header-subTitle">Cleaner, hack-free CSS</h2>
44
</div>
55
<div class="Header-actions">
6-
<a href="https://github.com/philipwalton/solved-by-flexbox" class="Header-button Button Button--action Button--wide"><span class="icon-github icon-large"></span>&nbsp; View Project Source</a>
7-
8-
<a href="http://twitter.com/intent/tweet?text={{ 'A showcase of traditionally hard CSS problems, easily solved using flexbox.' | urlencode }}&url=http://philipwalton.github.com/solved-by-flexbox/&via=philwalton" class="Header-button Button Button--wide"><span class="icon-twitter icon-large twitter-color"></span>&nbsp; Spread the Word</a>
6+
<a class="Header-button Button Button--action Button--wide"
7+
data-social-network="Github"
8+
data-social-action="view-source"
9+
href="https://github.com/philipwalton/solved-by-flexbox">
10+
<span class="icon-github icon-large"></span>&nbsp; View Project Source
11+
</a>
12+
<a class="Header-button Button Button--wide"
13+
data-social-network="Twitter"
14+
data-social-action="tweet"
15+
href="http://twitter.com/intent/tweet?text={{ 'A showcase of traditionally hard CSS problems, easily solved using flexbox.' | urlencode }}&url=http://philipwalton.github.com/solved-by-flexbox/&via=philwalton">
16+
<span class="icon-twitter icon-large twitter-color"></span>&nbsp; Spread the Word
17+
</a>
918
</div>

templates/html-inspector.html

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,16 @@
11
{% if env == 'dev' %}
2-
32
<script src="http://cdnjs.cloudflare.com/ajax/libs/html-inspector/0.8.1/html-inspector.js"></script>
4-
53
<script>
6-
7-
HTMLInspector.rules.extend("unused-classes", function(config) {
8-
config.whitelist = config.whitelist.concat([
9-
// "twitter-follow-button",
10-
/^icon/,
11-
/^wf-/
12-
])
13-
return config
4+
HTMLInspector.rules.extend('unused-classes', function(config) {
5+
config.whitelist = config.whitelist.concat([/^icon/, /^wf-/, /^hljs-/]);
6+
return config;
147
})
158

16-
HTMLInspector.rules.extend("script-placement", function(config) {
17-
config.whitelist = config.whitelist.concat([".js-allow-in-head"])
18-
return config
19-
})
20-
21-
// start the inspection
22-
// HTMLInspector.inspect({
23-
// excludeElements: ["svg", "iframe"]
24-
// })
9+
HTMLInspector.rules.extend('script-placement', function(config) {
10+
config.whitelist = config.whitelist.concat(['.js-allow-before-footer']);
11+
return config;
12+
});
2513

14+
HTMLInspector.inspect({excludeElements: ['svg', 'iframe']});
2615
</script>
27-
2816
{% endif %}

templates/scripts.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<script src="/main.js"></script>
2+
13
{% include 'twitter.html' %}
24
{% include 'html-inspector.html' %}
3-
<script src="/main.js"></script>
5+
{% include 'google-analytics.html' %}

0 commit comments

Comments
 (0)