Skip to content

Instantly share code, notes, and snippets.

View josemarluedke's full-sized avatar

Josemar Luedke josemarluedke

View GitHub Profile
import ApplicationInstance from '@ember/application/instance';
export function initialize(appInstance: ApplicationInstance): void {
const fastboot = appInstance.lookup('service:fastboot');
const apolloCache = appInstance.lookup('service:apollo').client.cache;
const shoebox = fastboot.get('shoebox');
if (fastboot.get('isFastBoot')) {
shoebox.put('apollo-cache', {
get cache(): unknown {
@josemarluedke
josemarluedke / ember-cil-build.js
Created April 12, 2020 00:34
Ember + TailwindCSS + PurgeCSS + CSS Modules
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const env = EmberApp.env();
const purgecssOptions = {
content: ['./app/index.html', './app/**/*.hbs', './node_modules/**/*.hbs'],
defaultExtractor: (content) => {
return content.match(/[A-Za-z0-9-_:/]+/g) || [];
},
import ApolloService from 'ember-apollo-client/services/apollo';
import { persistCache } from 'apollo-cache-persist';
class OverriddenApollo extends ApolloService {
async init() {
await persistCache({
this.cache(),
storage: window.localStorage,
});
import ApolloService from 'ember-apollo-client/services/apollo';
import { tracked } from '@glimmer/tracking';
import { resource } from 'ember-usable';
import { inject as service } from '@ember/service';
import { getOwner } from '@ember/application';
import {
ApolloQueryResult,
NetworkStatus,
OperationVariables,
DocumentNode,
const Docfy = require('@docfy/core');
const getConfig = require('@docfy/ember/lib/get-config').default;
const config = getConfig(__dirname);
(async function () {
const docfy = new Docfy(config);
const result = await docfy.run(config.sources);
let totalDemoComponents = 0;
import { getOwner } from '@ember/application';
import type RouterService from '@ember/routing/router-service';
function useService<T = unknown>(ctx: object, name: string): T {
return getOwner(ctx).lookup(`service:${name}`) as T;
}
function ref<T = unknown>(initialValue: T): Ref<T> {
return new Ref<T>(initialValue);
}