alphagov/govuk_frontend_toolkit

Document recommended way to use this with python / django

Closed this issue · 2 comments

There are a couple of packages on pypi

https://pypi.python.org/pypi/govuk-template

https://pypi.python.org/pypi/django-govuk-template/0.2

The second one of these says



It should be easy to make a Django-based service that follows Government Digital Services’ style guide and reference materials. But https://pypi.python.org/pypi/govuk-template is not kept updated and is not readily usable in Django and https://github.com/alphagov/govuk_template cannot be installed directly into a Django project without complex build steps.

This package takes components published by GDS and creates an app in a Django project which can then be used as normal. This process downloads a release from https://github.com/alphagov/govuk_template and the contents of Node.js packages https://www.npmjs.com/package/govuk-elements-sass and https://www.npmjs.com/package/govuk_frontend_toolkit

This project should document the recommended way of integrating with django, and ideally - as part of it's release process update the first one of those packages.

If you can't get hold of the maintainer of the pypi package, then it is worth opening a ticket here
https://github.com/pypa/pypi-legacy/issues

Hi @stuaxo.
The easiest way to integrate it would be to create a package.json file in your application with npm init (nodejs needs to be installed)
You then install the toolkit with npm install --save govuk_frontend_toolkit.
If you need javascript files, they will live in (node_modules/govuk_frontend_toolkit/javascripts).
If you need stylesheets they will live in (node_modules/govuk_frontend_toolkit/stylesheets).

With Django you can use https://github.com/jrief/django-sass-processor to compile Sass files.
Note: if you need complete styles you might want to install govuk-elements-sass package that also installs toolkit

Cheers for this. I'm not using the govuk frontend toolkit in my current project, but if I use it in my next project I will certainly take the info you just wrote and add it to the README here.