Custom CSS in the DB?



  • One interesting thing that PHPBB did (not sure if it's like this still, havnt looked in awhile) was giving you the ability to store CSS in the database.

    It would be nice to be able to just have a custom css in the options that would load regardless of what plugin, theme, version, etc was installed or upgraded.

    Right now I'm just editing the less files directly but I think it'd be an easy way to give access to CSS without the worry about losing the changes when you have to upgrade or reinstall.

    Off topic but just curious: Are there plans for an auto update feature for nodebb?


  • Plugin & Theme Dev

    @theepiphany why not extending the theme, and make your sub-theme depend on the super-theme,

    if that's not an option, why not a custom .css file in, and just a path to it in the DB? then inject it.
    well, either way, you can do that with a plugin too, by injecting your CSS in a <style> or <link> tag in the footer. (since the filter:header.build is currently limited to push items on the navigation bar.)

    You do not need to update the .less files.

    am i missing something? or did that answer your question.


  • Plugin & Theme Dev

    This post is deleted!


  • @bentael said:

    @theepiphany why not extending the theme, and make your sub-theme depend on the super-theme,

    if that's not an option, why not a custom .css file in, and just a path to it in the DB? then inject it.
    well, either way, you can do that with a plugin too, by injecting your CSS in a <style> or <link> tag in the footer. (since the filter:header.build is currently limited to push items on the navigation bar.)

    You do not need to update the .less files.

    am i missing something? or did that answer your question.

    That's actually what I'm doing now is moving all of my changes into my own sub theme. It was just a random thought I had while I was doing it, so figured I'd bring it up since it's very likely folks will be happy with the vanilla nodebb install and probably be mostly happy with all of the themes sure to come but maybe wanting to make one or two minor color changes. Would make it fairly simple for people who don't want to mess around with the files themselves.


  • Plugin & Theme Dev

    @theepiphany gotcha!

    for that specific purpose, I would use a plugin, this one, nodebb-plugin-42, (current screen shot - plugin needs a code refactor, but works for today), it lets u prepend anything to the <footer>, and append anything to the <body>, i probably should add append to the <head>.



  • @bentael said:

    @theepiphany gotcha!

    for that specific purpose, I would use a plugin, this one, nodebb-plugin-42, (current screen shot - plugin needs a code refactor, but works for today), it lets u prepend anything to the <footer>, and append anything to the <body>, i probably should add append to the <head>.

    Looking forward to trying this soon, just waiting for the plugin to be installed then I can finish sorting out the layout.



  • @bentael I was looking at that yesterday. Very nice plugin.

    For the less experienced users, maybe add a "Custom CSS" option that automatically puts in the <style> tags at the beginning and </style> at the end, then use tell codemirror to use css styling for that box.

    Either way I'm going to be installing it later today 🙂


  • Plugin & Theme Dev

    @Chris I will add this styling this weekend, I'm also gotta fix up the plugin a little, the way I load the settings is a little hacky. .. so you can always update 🙂


Log in to reply
 

Suggested Topics

  • 3
  • 4
  • 1
  • 4
  • 9
| |