From 73a57858e00b7e2c3822a92258931b2511a748e1 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Tue, 9 Aug 2022 02:37:12 -0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20custom=20css/assets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit typo fix gulpfile --- README.md | 5 +++++ custom/instance.css | 7 +++++++ gulpfile.js | 7 ++++++- packages/backend/src/server/web/views/base.pug | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 custom/instance.css diff --git a/README.md b/README.md index c991819659..36606c12d8 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,11 @@ cp ../misskey/.config/default.yml ./.config/default.yml # replace `../misskey/` # cp -r ../misskey/files . # if you don't use object storage ``` +## 💅 Customize + +- To add custom CSS for all users, edit `/custom/instance.css`. +- To add static assets (such as images for the splash screen), place them in the `/custom/` folder. They'll then be avaliable on `https://yourinstance.tld/static-assets/filename.png`. + ## 🚀 Build and launch! ### `git pull` and run these steps to update Calckey in the future! diff --git a/custom/instance.css b/custom/instance.css new file mode 100644 index 0000000000..9a70e66426 --- /dev/null +++ b/custom/instance.css @@ -0,0 +1,7 @@ +/* +* !!! WARNING !!! +* Editing this file may cause your instance to break for EVERYONE. +* Please know what you're doing and test it out with regular user custom CSS. +* With that said, GLHF! +* This may eventuallly be replaced with a function in the admin panel. + */ diff --git a/gulpfile.js b/gulpfile.js index 90f8ebaabe..2eaeac0f34 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,6 +15,10 @@ gulp.task('copy:backend:views', () => gulp.src('./packages/backend/src/server/web/views/**/*').pipe(gulp.dest('./packages/backend/built/server/web/views')) ); +gulp.task('copy:backend:custom', () => + gulp.src('./custom/*').pipe(gulp.dest('./packages/backend/assets/')) +); + gulp.task('copy:client:fonts', () => gulp.src('./packages/client/node_modules/three/examples/fonts/**/*').pipe(gulp.dest('./built/_client_dist_/fonts/')) ); @@ -35,6 +39,7 @@ gulp.task('copy:client:locales', cb => { cb(); }); + gulp.task('build:backend:script', () => { return gulp.src(['./packages/backend/src/server/web/boot.js', './packages/backend/src/server/web/bios.js', './packages/backend/src/server/web/cli.js']) .pipe(replace('LANGS', JSON.stringify(Object.keys(locales)))) @@ -53,7 +58,7 @@ gulp.task('build:backend:style', () => { }); gulp.task('build', gulp.parallel( - 'copy:client:locales', 'copy:backend:views', 'build:backend:script', 'build:backend:style', 'copy:client:fonts', 'copy:client:fontawesome' + 'copy:client:locales', 'copy:backend:views', 'copy:backend:custom', 'build:backend:script', 'build:backend:style', 'copy:client:fonts', 'copy:client:fontawesome' )); gulp.task('default', gulp.task('build')); diff --git a/packages/backend/src/server/web/views/base.pug b/packages/backend/src/server/web/views/base.pug index 416f4d818f..925bd6ba90 100644 --- a/packages/backend/src/server/web/views/base.pug +++ b/packages/backend/src/server/web/views/base.pug @@ -36,6 +36,7 @@ html link(rel='prefetch' href='/static-assets/badges/not-found.png') link(rel='prefetch' href='/static-assets/badges/error.png') link(rel='stylesheet' href='/assets/fontawesome/css/all.css') + link(rel='stylesheet' href='/static-assets/instance.css') link(rel='modulepreload' href=`/assets/${clientEntry.file}`) each href in clientEntry.css