Add fathom script

And fix output dir for elm compile
This commit is contained in:
Eike Kettner 2020-09-07 23:28:02 +02:00
parent eb11b33028
commit 72569287ba
7 changed files with 95 additions and 4 deletions

View File

@ -75,7 +75,7 @@ object ZolaPlugin extends AutoPlugin {
Seq("--base-url", url) Seq("--base-url", url)
case None => case None =>
runYarnInstall("yarn", inDir.getParentFile, logger) runYarnInstall("yarn", inDir.getParentFile, logger)
runElmCompile("elm", inDir.getParentFile, outDir, logger) runElmCompile("elm", inDir.getParentFile, inDir, logger)
Seq.empty Seq.empty
} }
Cmd.run( Cmd.run(
@ -91,13 +91,13 @@ object ZolaPlugin extends AutoPlugin {
def runYarnInstall(yarnCmd: String, inDir: File, logger: Logger): Unit = def runYarnInstall(yarnCmd: String, inDir: File, logger: Logger): Unit =
Cmd.run(Seq(yarnCmd, "install"), inDir, logger) Cmd.run(Seq(yarnCmd, "install"), inDir, logger)
def runElmCompile(elmCmd: String, inDir: File, zolaOut: File, logger: Logger): Unit = def runElmCompile(elmCmd: String, inDir: File, zolaRoot: File, logger: Logger): Unit =
Cmd.run( Cmd.run(
Seq( Seq(
elmCmd, elmCmd,
"make", "make",
"--output", "--output",
(zolaOut / "static" / "js" / "bundle.js").absolutePath.toString, (zolaRoot / "static" / "js" / "bundle.js").absolutePath.toString,
"--optimize", "--optimize",
(inDir / "elm" / "Main.elm").toString (inDir / "elm" / "Main.elm").toString
), ),

View File

@ -31,11 +31,27 @@
Not Found :( Not Found :(
</h1> </h1>
<h2 class="subtitle"> <h2 class="subtitle">
<a href="/docs">Documentation</a>? <a href="/docs">Documentation</a>?
</h2> </h2>
</div> </div>
</div> </div>
</section> </section>
{% include "footer.html" %} {% include "footer.html" %}
</body> </body>
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, '//webstats.daheim.site/tracker.js', 'fathom');
fathom('set', 'siteId', 'OGJDF');
fathom('trackPageview');
</script>
<!-- / Fathom -->
</html> </html>

View File

@ -17,4 +17,19 @@
flags: elmFlags flags: elmFlags
}); });
</script> </script>
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, '//webstats.daheim.site/tracker.js', 'fathom');
fathom('set', 'siteId', 'OGJDF');
fathom('trackPageview');
</script>
<!-- / Fathom -->
</html> </html>

View File

@ -56,4 +56,19 @@
{% include "footer.html" %} {% include "footer.html" %}
</body> </body>
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, '//webstats.daheim.site/tracker.js', 'fathom');
fathom('set', 'siteId', 'OGJDF');
fathom('trackPageview');
</script>
<!-- / Fathom -->
</html> </html>

View File

@ -89,4 +89,19 @@
{% include "footer.html" %} {% include "footer.html" %}
</body> </body>
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, '//webstats.daheim.site/tracker.js', 'fathom');
fathom('set', 'siteId', 'OGJDF');
fathom('trackPageview');
</script>
<!-- / Fathom -->
</html> </html>

View File

@ -62,4 +62,19 @@
{% include "footer.html" %} {% include "footer.html" %}
</body> </body>
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, '//webstats.daheim.site/tracker.js', 'fathom');
fathom('set', 'siteId', 'OGJDF');
fathom('trackPageview');
</script>
<!-- / Fathom -->
</html> </html>

View File

@ -82,4 +82,19 @@
{% include "footer.html" %} {% include "footer.html" %}
</body> </body>
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, '//webstats.daheim.site/tracker.js', 'fathom');
fathom('set', 'siteId', 'OGJDF');
fathom('trackPageview');
</script>
<!-- / Fathom -->
</html> </html>