Skip to main content

Django application to add the Bulma CSS framework and its extensions

Project description

django-simple-bulma

Build Status Discord

django-simple-bulma is a Django application that makes Bulma and Bulma-Extensions available to use in your Django project with as little setup as possible. The goal of this project is to make it as easy as possible to use Bulma with Django.

This project currently uses Bulma v0.7.2 and Bulma-Extensions v4.0.0. If you want features that are only available in newer versions of these frameworks, please create an issue, and we will be happy to update it.

Installation

To get django-simple-bulma, up and running for your Django project, follow these simple steps:

  • Install it from PyPI with pip install django-simple-bulma (or add it to your Pipfile)

  • In your Django projects settings.py file:

    • Add django_simple_bulma to your INSTALLED_APPS
      INSTALLED_APPS = [
        #...
        'django_simple_bulma',
        #...
      ]
      
    • Add django_simple_bulma.finders.SimpleBulmaFinder to your STATICFILES_FINDERS. This normally holds two default handlers that you will probably want to keep, so unless you have any other custom Finders, it should look like this:
      STATICFILES_FINDERS = [
        # First add the two default Finders, since this will overwrite the default.
        'django.contrib.staticfiles.finders.FileSystemFinder',
        'django.contrib.staticfiles.finders.AppDirectoriesFinder',
      
        # Now add our custom SimpleBulma one.
        'django_simple_bulma.finders.SimpleBulmaFinder',
      ]
      
  • Run python manage.py collectstatic command in order to build Bulma and move it to your staticfiles folder. Please note that you will need to use this command every time you make a change to the configuration, as this is the only way to rebuild the Bulma css file. If you are not using collectstatic, read up on it and start using it.

    This app works fine with Whitenoise, which is a great way to serve static files without needing to mess with your webserver.

  • django-simple-bulma should now be working. In order to import it into your template, simply use the following template tags:

      <head>
          <!-- ... -->
          {% load django_simple_bulma %}
          {% bulma %}
          <!-- ... -->
      </head>
    
  • You're all set! Any Bulma classes you apply should now be working!

Customization

Bulma looks nice by default, but most users will want to customize its look and feel. For this, we've provided a super simple way to change the Bulma variables and to choose which Bulma extensions you want to load into your project.

In order to do this, we'll simply create a dictionary inside your settings.py called BULMA_SETTINGS, and configure it there. Here's an example of what that looks like:

# Custom settings for django-simple-bulma
BULMA_SETTINGS = {
    "extensions": [
        "bulma-accordion",
        "bulma-calendar",
    ],
    "variables": {
        "primary": "#000000",
        "size-1": "6rem",
    }
}

You may here define any variable found on the Bulma variables page, and you may use any valid SASS or CSS as the value. For example, hsl(217, 71%, 53%) would be a valid value for a color variable, as would #ffff00. Please note that any syntactically incorrect values may prevent Bulma from building correctly, so be careful what you add here unless you know exactly what you're doing.

If the extensions key is not found, it will default to loading all extensions. If you don't want any extensions, simply set it to an empty list.

Additional scripts

For your convenience, we also give you the option to add other quality of life improvements to your Bulma app.

  • If you import bulma-fileupload into your extensions (or if you have not customized your extension settings), we will import a script that will handle displaying the filename in your file upload inputs. See https://bulma.io/documentation/form/file/ for more information about these.

Troubleshooting

If you run into any trouble with this app, please create an issue, and we will be happy to help you with it. Alternatively, head over to our discord server at https://discord.gg/python and we'll help you figure it out over chat.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-simple-bulma-1.0.5.tar.gz (184.8 kB view details)

Uploaded Source

Built Distribution

django_simple_bulma-1.0.5-py3-none-any.whl (228.6 kB view details)

Uploaded Python 3

File details

Details for the file django-simple-bulma-1.0.5.tar.gz.

File metadata

  • Download URL: django-simple-bulma-1.0.5.tar.gz
  • Upload date:
  • Size: 184.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for django-simple-bulma-1.0.5.tar.gz
Algorithm Hash digest
SHA256 a1ef7f067d3adeb1db572b4a13db1920279e2bbd26600e7ed2b07b172cdbde0c
MD5 3ed893fa1afb94d6e35e405563b435b9
BLAKE2b-256 2b8dae5ddb5c3c707cf1bf628bae408d127bdd084c61e874d851a2a5680ac3e3

See more details on using hashes here.

File details

Details for the file django_simple_bulma-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: django_simple_bulma-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 228.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for django_simple_bulma-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cc5043dc6da72df5109093d65bb8c304150bf8ad40d9014f0d48a7411b76d93f
MD5 1468705c1947b86cc995548a30c4e011
BLAKE2b-256 f8eb0da60d4c32dc7f7490dc1804fcfb10d3e8382413c10d257bdb384705ecd0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page