diff --git a/docs/development/build-config.md b/docs/development/build-config.md
index ceae10631..b4236d39d 100644
--- a/docs/development/build-config.md
+++ b/docs/development/build-config.md
@@ -118,7 +118,7 @@ When compiling Soapbox, environment variables may be passed to change the build
For example:
```sh
-NODE_ENV="production" FE_BUILD_DIR="public" FE_SUBDIRECTORY="/soapbox" yarn build
+NODE_ENV="production" FE_SUBDIRECTORY="/soapbox" yarn build
```
### `NODE_ENV`
@@ -147,16 +147,6 @@ Options:
Default: `""`
-### `FE_BUILD_DIR`
-
-The folder to put build files in. This is mostly useful for CI tasks like GitLab Pages.
-
-Options:
-
-- Any directory name, eg `"public"`
-
-Default: `"dist"`
-
### `FE_SUBDIRECTORY`
Subdirectory to host Soapbox out of.
diff --git a/index.html b/index.html
index 280ab913f..25e84494a 100644
--- a/index.html
+++ b/index.html
@@ -8,6 +8,7 @@
+ <%- snippets %>
diff --git a/src/build-config-compiletime.ts b/src/build-config-compiletime.ts
index 6f9cb2aba..15915cbdb 100644
--- a/src/build-config-compiletime.ts
+++ b/src/build-config-compiletime.ts
@@ -12,7 +12,6 @@ const {
NODE_ENV,
BACKEND_URL,
FE_SUBDIRECTORY,
- FE_BUILD_DIR,
FE_INSTANCE_SOURCE_DIR,
SENTRY_DSN,
} = process.env;
@@ -29,16 +28,11 @@ const sanitizeBasename = (path: string | undefined = ''): string => {
return `/${trim(path, '/')}`;
};
-const sanitizePath = (path: string | undefined = ''): string => {
- return trim(path, '/');
-};
-
export default () => ({
data: {
NODE_ENV: NODE_ENV || 'development',
BACKEND_URL: sanitizeURL(BACKEND_URL),
FE_SUBDIRECTORY: sanitizeBasename(FE_SUBDIRECTORY),
- FE_BUILD_DIR: sanitizePath(FE_BUILD_DIR) || 'dist',
FE_INSTANCE_SOURCE_DIR: FE_INSTANCE_SOURCE_DIR || 'instance',
SENTRY_DSN,
},
diff --git a/src/build-config.ts b/src/build-config.ts
index e3e5436bf..38515cdd3 100644
--- a/src/build-config.ts
+++ b/src/build-config.ts
@@ -3,7 +3,6 @@ const {
NODE_ENV,
BACKEND_URL,
FE_SUBDIRECTORY,
- FE_BUILD_DIR,
FE_INSTANCE_SOURCE_DIR,
SENTRY_DSN,
} = import.meta.compileTime('./build-config-compiletime.ts');
@@ -12,7 +11,6 @@ export {
NODE_ENV,
BACKEND_URL,
FE_SUBDIRECTORY,
- FE_BUILD_DIR,
FE_INSTANCE_SOURCE_DIR,
SENTRY_DSN,
};
\ No newline at end of file
diff --git a/tailwind.config.cjs b/tailwind.config.cjs
index 57ff65f3c..36b7a1efc 100644
--- a/tailwind.config.cjs
+++ b/tailwind.config.cjs
@@ -2,7 +2,7 @@ const { parseColorMatrix } = require('./tailwind/colors.cjs');
/** @type {import('tailwindcss').Config} */
module.exports = {
- content: ['./src/**/*.{html,js,ts,tsx}', './custom/instance/**/*.html', './src/index.html'],
+ content: ['./src/**/*.{html,js,ts,tsx}', './custom/instance/**/*.html', './index.html'],
darkMode: 'class',
theme: {
screens: {
diff --git a/vite.config.ts b/vite.config.ts
index 263f6a20b..ca86db12d 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,4 +1,5 @@
///
+import fs from 'node:fs';
import { fileURLToPath, URL } from 'node:url';
import react from '@vitejs/plugin-react';
@@ -36,6 +37,11 @@ export default defineConfig({
collapseWhitespace: true,
removeComments: false,
},
+ inject: {
+ data: {
+ snippets: readFileContents('custom/snippets.html'),
+ },
+ },
}),
react({
// Use React plugin in all *.jsx and *.tsx files
@@ -70,6 +76,9 @@ export default defineConfig({
}, {
src: './src/instance',
dest: '.',
+ }, {
+ src: './custom/instance',
+ dest: '.',
}],
}),
visualizer({
@@ -88,4 +97,13 @@ export default defineConfig({
environment: 'jsdom',
setupFiles: 'src/jest/test-setup.ts',
},
-});
\ No newline at end of file
+});
+
+/** Return file as string, or return empty string if the file isn't found. */
+function readFileContents(path: string) {
+ try {
+ return fs.readFileSync(path, 'utf8');
+ } catch {
+ return '';
+ }
+}