From 2e29830ba01c7796bbcae0bcd9c0dbe90bf40545 Mon Sep 17 00:00:00 2001 From: Marcell Mars Date: Thu, 20 Aug 2020 01:22:06 +0200 Subject: [PATCH] if one wants to add sveltejs.. will probably delete these... --- package.json | 29 ++++++++++ rollup.config.js | 58 ++++++++++++++++++++ svelte/App.svelte | 3 + svelte/main.js | 10 ++++ themes/sandpoints/layouts/partials/head.html | 4 ++ 5 files changed, 104 insertions(+) create mode 100644 package.json create mode 100644 rollup.config.js create mode 100644 svelte/App.svelte create mode 100644 svelte/main.js diff --git a/package.json b/package.json new file mode 100644 index 0000000..4ca6d8a --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "svelte-app", + "version": "1.0.0", + "devDependencies": { + "@fullhuman/postcss-purgecss": "^1.3.0", + "postcss": "^7.0.21", + "postcss-load-config": "^2.1.0", + "rollup": "^1.12.0", + "rollup-plugin-commonjs": "^10.0.0", + "rollup-plugin-livereload": "^1.0.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-svelte": "^5.0.3", + "rollup-plugin-terser": "^5.3.0", + "rollup-plugin-uglify": "^6.0.4", + "simple-svelte-autocomplete": "^1.1.1", + "svelte": "^3.0.0", + "svelte-preprocess": "^3.2.0-alpha.2", + "tailwindcss": "^1.1.3" + }, + "dependencies": { + "sirv-cli": "^0.4.4" + }, + "scripts": { + "build": "rollup -c", + "dev": "rollup -c -w", + "start": "sirv public --single", + "start:dev": "sirv public --single --dev" + } +} diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..a9e6fbb --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,58 @@ +import svelte from 'rollup-plugin-svelte'; +import resolve from 'rollup-plugin-node-resolve'; +import commonjs from 'rollup-plugin-commonjs'; +import livereload from 'rollup-plugin-livereload'; +import { terser } from 'rollup-plugin-terser'; +import sveltePreprocess from 'svelte-preprocess'; + +//import rollup_start_dev from './rollup_start_dev'; + +const production = !process.env.ROLLUP_WATCH; + +export default { + input: 'svelte/main.js', + output: { + sourcemap: true, + format: 'iife', + name: 'app', + file: 'public/js/svelte.js' + }, + plugins: [ + svelte({ + preprocess: sveltePreprocess({ postcss: true }), + // enable run-time checks when not in production + dev: !production, + // we'll extract any component CSS out into + // a separate file — better for performance + css: css => { + css.write('public/css/svelte.css'); + } + }), + + // If you have external dependencies installed from + // npm, you'll most likely need these plugins. In + // some cases you'll need additional configuration — + // consult the documentation for details: + // https://github.com/rollup/rollup-plugin-commonjs + resolve({ + browser: true, + dedupe: importee => importee === 'svelte' || importee.startsWith('svelte/') + }), + commonjs(), + + // In dev mode, call `npm run start:dev` once + // the bundle has been generated + //!production && rollup_start_dev, + + // Watch the `public` directory and refresh the + // browser on changes when not in production + !production && livereload('public'), + + // If we're building for production (npm run build + // instead of npm run dev), minify + production && terser() + ], + watch: { + clearScreen: false + } +}; diff --git a/svelte/App.svelte b/svelte/App.svelte new file mode 100644 index 0000000..a889c41 --- /dev/null +++ b/svelte/App.svelte @@ -0,0 +1,3 @@ + diff --git a/svelte/main.js b/svelte/main.js new file mode 100644 index 0000000..d6cacbb --- /dev/null +++ b/svelte/main.js @@ -0,0 +1,10 @@ +import App from './App.svelte'; + +const app = new App({ + target: document.body, + props: { + name: 'world' + } +}); + +export default app; \ No newline at end of file diff --git a/themes/sandpoints/layouts/partials/head.html b/themes/sandpoints/layouts/partials/head.html index 3715416..dcc64b1 100644 --- a/themes/sandpoints/layouts/partials/head.html +++ b/themes/sandpoints/layouts/partials/head.html @@ -25,5 +25,9 @@ + {{ $currentSession := . }} + + + {{ block "title" . }}{{- .Title }} - {{ .Site.Title -}}{{ end }}