I was looking for a SSR and scoped styles ready solution to implement inline SVG with Nuxt
You need svg-inline-loader
and xmldom
to be installed.
self.addEventListener('install', (e) => { | |
e.waitUntil( | |
caches.open("precache").then((cache) => cache.add("/broken.png")) | |
); | |
}); | |
function isImage(fetchRequest) { | |
return fetchRequest.method === "GET" && fetchRequest.destination === "image"; | |
} |
I was looking for a SSR and scoped styles ready solution to implement inline SVG with Nuxt
You need svg-inline-loader
and xmldom
to be installed.
import hash from 'object-hash' | |
import sizeof from 'object-sizeof' | |
import lruCache from 'lru-cache' | |
const cacheEnabled = true | |
const cacheMaxAge = 30 * 60 * 1000 | |
const cacheMaxSize = 128 * 1000 * 1000 | |
const getCacheKey = obj => hash(obj) |
General setup:
npm install --save-dev bootstrap@4.0.0-beta.2 node-sass sass-loader
export default ({ app }) => { | |
if (process.env.NODE_ENV !== 'production') return | |
const KEY = 'ga:user' | |
const UID = (localStorage[KEY] = localStorage[KEY] || Math.random() + '.' + Math.random()) | |
function encode(obj) { | |
let k | |
let str = 'https://www.google-analytics.com/collect?v=1' | |
for (k in obj) { |
// store/index.js | |
const createStore = () => { | |
return new Vuex.Store({ | |
state: { | |
counter: 0, | |
repos: [] | |
}, | |
actions: { | |
LOAD_REPOS: function({ commit }) { | |
axios.get('url').then((res) => { |
sudo apt-get install python-software-properties -y | |
sudo add-apt-repository ppa:ondrej/php -y | |
sudo apt-get update -y | |
sudo apt-get install php7.2 php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml | |
sudo apt-get install libapache2-mod-php7.2 -y | |
sudo a2dismod php5 | |
sudo a2enmod php7.2 | |
sudo service apache2 restart |
var fb = new DSFirebaseAdapter({ | |
basePath: 'https://my-app.firebase.io' | |
}); | |
var ls = new DSLocalStorageAdapter(); | |
var store = new JSData.DS({ | |
// try firebase first, otherwise try offline data | |
fallbackAdapters: ['fb', 'ls'], | |
// After creating an item, sync it to localStorage |
/** | |
* Sends an email using the contents of a Google Document as the body. | |
*/ | |
function sendDocument(documentId, recipient, subject) { | |
var html = convertToHtml(documentId); | |
html = inlineCss(html); | |
GmailApp.sendEmail(recipient, subject, null, { | |
htmlBody: html | |
}); | |
} |