Skip to content

Instantly share code, notes, and snippets.

// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
// import { eslint } from 'rollup-plugin-eslint'
import { terser } from 'rollup-plugin-terser'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
import environmentVariables from './config/env'
@evdama
evdama / tailwind.css
Created August 4, 2019 11:04
tailwind colors for light and dark theme via CSS variables
@import "tailwindcss/base";
@import "tailwindcss/components";
@import './components';
@import "tailwindcss/utilities";
@import './edm-utilities';
:root {
--font-family-one: Montserrat, sans-serif;
--font-family-two: Roboto, sans-serif;
@evdama
evdama / rollup.config.js
Created July 7, 2019 05:52
sapper project with tailwind using purgecss and cssnano
// @ts-nocheck TODO: remove at some point
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import config from 'sapper/config/rollup.js';
import getPreprocessor from 'svelte-preprocess'
import path from 'path'
import pkg from './package.json';
import postcss from 'rollup-plugin-postcss'
import replace from 'rollup-plugin-replace';
@evdama
evdama / ThemeToggle.svelte
Created August 5, 2019 17:50
how to move the window.matchMedia to <svelte:window>
<script>
import { onMount } from 'svelte';
let html, currentColorScheme = 'light';
onMount(
() => {
html = document.getElementsByTagName('html')[0]
window.matchMedia('(prefers-color-scheme: dark)').addListener(({ matches }) => {
if (matches) {
@evdama
evdama / rollup.config.js
Created November 27, 2020 21:33
duplicate babel snippet to server section so svelte-grid optional chaining code works in combination with firebase which still runs node 12
// @ts-nocheck //TODO: enable remove once there are typings in place
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
import { terser } from 'rollup-plugin-terser'
import babel from '@rollup/plugin-babel'
import commonjs from '@rollup/plugin-commonjs'
import config from 'sapper/config/rollup.js'
import environmentVariables from './config/env'
import getPreprocessor from 'svelte-preprocess'
import getTime from 'date-fns/getTime'
Gun.chain.subscribe = function( publish ) { // arrow function would loose scope i.e. its this so doesn't work
let gun = this
let at = gun._
let isMap = !!at && !!at.back && !!at.back.each // check if the map() function has been called
if ( isMap ) {
let store = new Map()
publish( Array.from( store ) )
<script>
import { fade, fly } from 'svelte/transition'
import { onMount } from 'svelte'
import { writable } from 'svelte/store'
import * as animateScroll from 'svelte-scrollto'
import PageTransition from '../components/ui/PageTransition.svelte'
import Spinner from '../components/ui/Spinner.svelte'
import Profile from '../components/communication_channels/todos/Profile.svelte'
import getTime from 'date-fns/getTime'
import formatDistanceToNow from 'date-fns/formatDistanceToNow'
@evdama
evdama / ThemeToggle.svelte
Created August 4, 2019 11:03
switch theme between light and dark
<script>
import { onMount } from 'svelte';
let html, currentColorScheme = 'light';
onMount(
() => {
html = document.getElementsByTagName('html')[0]
window.matchMedia('(prefers-color-scheme: dark)').addListener(({ matches }) => {
if (matches) {
@evdama
evdama / rollup.config.js
Created May 8, 2020 09:14
trying Shiv way of integrating tw into Sapper project
// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
// import { eslint } from 'rollup-plugin-eslint'
import { terser } from 'rollup-plugin-terser'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
import environmentVariables from './config/env'
@evdama
evdama / tailwind.css
Last active May 8, 2020 08:19
:root contents not picked up by new tw setup
@import "tailwindcss/base";
@import "tailwindcss/components";
@import './components';
@import "tailwindcss/utilities";
@import './edm-utilities';
@import 'nprogress/nprogress.css'
:root {
--font-family-one: Inter var, sans-serif;
--font-weight-black: 900;