Skip to content

Instantly share code, notes, and snippets.

View stefanledin's full-sized avatar

Stefan Ledin stefanledin

View GitHub Profile
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
.navbar {
position: fixed;
top: 0;
left: 0;
right: 0;
(function () {
// An object with options for the IntersectionObserver.
const options = {
// 0.5 = The callback is fired when 50% of the element is visible
// We can add more values to the array, like 0.25, 0.75 or 1.0
threshold: [0.5]
};
// Instantiate the IntersectionObserver class
const observer = new IntersectionObserver((entries, observer) => {
elixir(function(mix) {
// My elixir code goes here
});
gulp.task('generate-service-worker', function(callback) {
var swPrecache = require('sw-precache');
var rootDir = 'public';
swPrecache.write(`${rootDir}/service-worker.js`, {
staticFileGlobs: [
<footer>
<form action="/" method="GET">
<input type="search" name="search">
<input type="submit" value="Search">
</form>
<div class="search-results">
<?php
if ( isset ( $_GET['search'] ) ) {
<!doctype html>
<html>
<head>
<title>This template is working!</title>
</head>
<body>
</body>
</html>
<!doctype html>
<html>
<head>
<title>This template isn't working!</title>
</head>
<body>
</body>
</html>
<?php
/*
Template name: Not working
*/
?>
<?php get_header(); ?>
<?php
/*
Template name: Working!
*/
get_header();
?>
gulp.task('generate-service-worker', function(callback) {
var swPrecache = require('sw-precache');
var rootDir = 'public';
swPrecache.write(`${rootDir}/service-worker.js`, {
staticFileGlobs: [
rootDir + '/build/**/*.{js,css}',
rootDir + '/img/**/*.{jpg,png,svg}'
],
stripPrefix: rootDir
gulp.task('generate-service-worker', function(callback) {
var swPrecache = require('sw-precache');
var rootDir = 'public';
swPrecache.write(`${rootDir}/service-worker.js`, {
staticFileGlobs: [
rootDir + '/build/**/*.{js,css}',
rootDir + '/img/**/*.{jpg,png,svg}'
],
dynamicUrlToDependencies: {