Coder Social home page Coder Social logo

Comments (1)

tehfink avatar tehfink commented on June 12, 2024 3

Here's what I ended up doing in order to use Bulma's swatches & components, in case it helps anyone. Is there a better method?

Beginning with what's currently in the documentation:
pip install django-bulma
Add to settings.py: 'bulma',
Set up bulma & extensions:
python manage.py copy_bulma_static_into_project
python manage.py bulma install
Locate the directory with package.json, in order for npm to install in the correct place:
cd …my_django_project/static/bulma/sass
npm install bulmaswatch bulma-extensions
python manage.py bulma start

My style.sass looks like:

// 1. Import the initial variables
@import "./node_modules/bulma/sass/utilities/initial-variables"

// 2. Set your own initial variables
@import './node_modules/bulmaswatch/simplex/_variables';

// 3. Import the rest of Bulma
@import "./node_modules/bulma/bulma"

// 4. Import your stuff here
@import './node_modules/bulma-extensions/bulma-carousel/src/sass/index';
@import './node_modules/bulmaswatch/simplex/_overrides';

And in the django template:

{% block css %}
    <link rel="stylesheet" href="{% static 'bulma/css/font-awesome.min.css' %}">
    <link rel="stylesheet" href="{% static 'bulma/css/style.css' %}">
    {% block extra_css %}{% endblock extra_css %}
{% endblock css %}
…
{% block extra_javascript %}
<script type="text/javascript" src="{% static 'bulma/sass/node_modules/bulma-extensions/bulma-carousel/dist/js/bulma-carousel.min.js' %}"></script>
<script type="text/javascript">
    var carousels = bulmaCarousel.attach(); // carousels now contains an array of all Carousel instances
</script>
{% endblock extra_javascript %}

from django-bulma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.