Open
Conversation
fe732a4 to
76a9814
Compare
76a9814 to
567e684
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
For a while I had the growing impression that SpaceDock's front-end dependency handling was messier than it needed to be. Every now and then I would see what looked like an edit to a Bootstrap file in our git log and assumed the worst without really wanting to look into it further.
See the comments in #391 for an example of such confusion; I thought the weird menu background on mobile was caused by Bootstrap itself because it was in a file called
bootstrap-theme.css(which is the name of a file shipped by Bootstrap), but then I noticed that @V1TA5 had added that line in April 2016. I assumed that we had been editing copies of released files from other projects, which would have been a huge red flag for maintenance.Eventually I created #405 as a reminder to look into this in more depth.
Investigation findings
However, when I dug into the git log, a somewhat different picture emerged:
bootstrap-theme.css; all the other static dependencies embedded in the repo were identical to their originally committed versions 😌bootstrap-theme.cssis meant to be a user-owned config file! There are packages innpmcontaining nothing but alternate versions of this file for different themes, and in fact our own copy says "Generated using the Bootstrap Customizer", so it probably came from an interactive web tool's download button after various customizations were made. So it is fine to commit this file to our repo and edit it.Still, there is room for improvement here. Committing other projects' files to our repo is a bit sloppy, it makes updating dependencies (or sometimes just identifying them) more difficult, and some of the styling in
bootstrap-theme.cssdoesn't really relate to theming Bootstrap.Changes
frontend/static/cssandfrontend/static/js(and a few are removed fromfrontend/static/fonts). In most cases, the ones we actually use are now installed bynpmand then copied fromnode_modulestobuild/bybuild.js. This means we can manage front-end dependency versions withnpm, so upgrades are easier.npmbut then imported into a new filefrontend/styles/bundle.scssso we can set their font paths to/staticeditor.jswe were using does not seem to have a compiled version available innpmand is essentially unmaintained, so it is replaced by https://www.npmjs.com/package/@devhau/md-editor, which is a pretty nice drop-in replacement with a slight WYSIWYG vibedropzone(contrary tonpm's promise that the^prefix means "Compatible with version") until we grabbed the.Dropzoneobject out of it insteadfrontend/static/css/create.csswas a compiled version offrontend/styles/create.scssand is deletedfrontend/static/css/bootstrap_dark.min.csswas not in use and is deletedfrontend/static/css/bootstrap-theme.cssnow contains only generic theming that could apply to any Bootstrap-based sitefrontend/styles/stylesheet.scssfrontend/styles/listing.scss5 mm), which is not valid CSS. They can be re-added and tested properly if we decide we want them.flipperclass is moved tofrontend/styles/flipper.scssin case we decide to revive it. It makes the mod box rotate around on hover, which could be either neat or annoying. It's not clear whether this was planned or debated at some point in the past or just not finished. I posted an animation of it in the chat and am waiting for feedback./static/stylesheet.cssis now included for all pages bylayout.htmlinstead of being pulled in by many different (but not all) templatesbuild.jsnow minifies our generated scripts and removes whitespace from our stylesheets<noun>_<verb>.<extension>for consistency and more convenient sorting (withviewtreated as the default, absent verb)layout.htmland intoglobal.coffeediv.headerpreviously had abackground: transparent;style which was immediately overridden bybackground-color: #FFFFFF;. In practice all this accomplished was to mess up the layout of the header graphic. This is now removed so the header graphic will appear as it was intended to.Now if we want to upgrade Bootstrap (or any other dependency), switch to a fresh Bootstrap theme, or add new front-end dependencies, all we will have to do is run a few
npmcommands and start coding. An up to date site is a happy site.Fixes #405.