diff --git a/docs/index.rst b/docs/index.rst index fd0c303ef..2e19b69f9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -28,6 +28,7 @@ Part 2: Developer's Guide localization search frontend + svelte browser_permissions zendesk notes diff --git a/docs/svelte.md b/docs/svelte.md new file mode 100644 index 000000000..6f282a3c5 --- /dev/null +++ b/docs/svelte.md @@ -0,0 +1,48 @@ +# Svelte + +## CSS/SASS + +Svelte supports writing CSS directly in a component within ` diff --git a/svelte/contribute/Link.svelte b/svelte/contribute/Link.svelte index 4b02919a8..c50fb2e48 100644 --- a/svelte/contribute/Link.svelte +++ b/svelte/contribute/Link.svelte @@ -7,3 +7,17 @@
  • + + diff --git a/webpack.common.js b/webpack.common.js index 807d97fdb..5ebd87128 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,6 +1,7 @@ const webpack = require("webpack"); const path = require("path"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const sveltePreprocess = require("svelte-preprocess"); module.exports = { mode: "development", @@ -10,10 +11,10 @@ module.exports = { sumo: path.resolve(__dirname, "kitsune/sumo/static/sumo"), community: path.resolve(__dirname, "kitsune/community/static/community"), kpi: path.resolve(__dirname, "kitsune/kpi/static/kpi"), - svelte: path.resolve('node_modules', 'svelte') + svelte: path.resolve("node_modules", "svelte"), }, - extensions: ['.mjs', '.js', '.svelte'], - mainFields: ['svelte', 'browser', 'module', 'main'] + extensions: [".mjs", ".js", ".svelte"], + mainFields: ["svelte", "browser", "module", "main"], }, module: { rules: [ @@ -43,17 +44,23 @@ module.exports = { }, { test: /\.svelte$/, - use: "svelte-loader", + use: { + loader: "svelte-loader", + options: { + emitCss: true, + preprocess: sveltePreprocess(), + }, + }, }, { // required to prevent errors from Svelte on Webpack 5+ test: /node_modules\/svelte\/.*\.mjs$/, resolve: { - fullySpecified: false - } + fullySpecified: false, + }, }, { - test: /\.scss$/, + test: /\.s?css$/, use: [ MiniCssExtractPlugin.loader, "css-loader",