Package: django-simple-buefy
django-simple-buefyThis project aims to provide an easy, automatic way to includeBuefy,BulmaandVuealongside your Django project.This project currently make use ofBuefy 0.8.7,Bulma 0.7.5andVue 2.6.10. If you need something in a newer version of these libraries,
please feel free tocreate an issueand we'll get around to it when we can.This project is a direct fork of Python Discord's excellentdjango-simple-bulmaproject, and it therefore has many similarities with it. Big thanks to
thePython Discordteam for their work on
that project!SetupTo getdjango-simple-buefyup and running for your Django project,
follow these simple steps:Install it via Pip (pip install django-simple-buefy) or other dependency
management toolIn yoursettings.pyfile:Adddjango_simple_buefyto yourINSTALLED_APPSAdddjango_simple_buefy.finders.SimpleBuefyFinderto yourSTATICFILES_FINDERSRunpython manage.py collectstaticin order to build and collect all of
the assets handled bydjango-simple-buefy; please note that you'll need to do
this again when you change yourdjango-simple-buefyconfigurationIn your templates, loaddjango_simple_buefyto make use of its template tags:{% buefy %}placed in your template's<head>will insert script and link tags
for the filesdjango-simple-buefyprovidesCreate your Vue app and get hacking!Please note that unlikedjango-simple-bulma,django-simple-buefydoes not provide
any icon sets. Buefy recommendsMaterial Design Icons,
butFont-Awesome 5is also fully compatible.CustomisationLikedjango-simple-bulma, this project supports customisation of the SASS variables
that are used by Bulma and Buefy. You can do this in a similar fashion, by creating
theBUEFY_SETTINGSdictionary within yoursetup.py.BUEFY_SETTINGS={"variables":{"primary":"#000","size-1":"6rem"}}All values must be valid SASS or CSS. For more information on the variables you
can customise, please seethe Buefy documentation.Template Tag SettingsAdded in version 1.0.3Because there are many different situations that need to be addressed by a
library like this,django-simple-buefycontains some additional settings
for your project.Module ModeBy default,django-simple-buefywill assume that you'd like to make use ofES6 modules, and the{% buefy %}tag
will only include the relevant Buefy<script>tags to support this. To change
this behaviour, you can set the following values:BUEFY_SETTINGS={# Include both ES6 "module" and vanilla "nomodule" tags"modules":None,}BUEFY_SETTINGS={# Include only vanilla "text/javascript" tags, without "nomodule""modules":False,}If you'd like to ensure the default behaviour, then you can set this value
toTrueas well.BUEFY_SETTINGS={# Include only ES6 "module" tags"modules":True,}Please note that the setting above also affects Vue<script>tags. If you're
using Vue as a module, it's still up to you toimportit in your own scripts.This library does not supportCommonJSmodules.Debug ModeBy default, the{% buefy %}template tag will insert<script>tags pointing
to minified versions of the relevant libraries. When you're developing, it can
be useful to use the non-minified versions of your JavaScript libraries - so
you can use thedebugsetting below to do exactly that.fromosimportenvironBUEFY_SETTINGS={"debug":"DEBUG"inenviron# For example}Additional SCSS FilesIf your project also includes additional SCSS files, you may specify them in yoursettings.pyfile in a similar manner.BUEFY_SETTINGS={"custom_scss":["myapp/static/css/base/base.scss",],}Please note: The default Django behavior when collecting static files is to keep
the containing file structure for them when they're copied over to the final static
files directory. We attempt to do the same thing by parsing the given path to your.scssfile, using the following strategy:If a containing path exists in theSTATICFILES_DIRSsetting, assume that this
is the base path to use, and the directory structure below it will be used to
contain the resulting.cssfileOtherwise, if the path containsstatic/, assume that the base path ends there
and use the rest of the path below it to contain the resulting.cssfile.If both of these strategies fail to figure out what base path to use, an exception will be raised.TroubleshootingIf you have the Python modulesassinstalled, please note that it is incompatible
with this project. There is a namespace conflict betweensassandlibsasswhich
will makedjango-simple-buefycrash when you attempt to do acollectstatic. To
solve this, just uninstallsassand uselibsassinstead.If you're having trouble getting your Vue apps and components correctly, remember to
double-check that Buefy has been loaded in advance of your own JavaScript being loaded.If you run into any other problems with this app, pleasecreate an issueand we'll be happy to help you out.