Automatic recompilation of Bootstrap with user-defined variables (#1181)

Allow for dynamic bootstrap compilation

Exclude sublime artifacts

Make custom bootstrap vars file

Add custom bootstrap compilation

Add cookiecutter option

Use the right name for the file

Add explanation to generated README

Add self to contributors

Remove sublime exclusion
This commit is contained in:
Ben Warren 2017-06-12 12:38:00 -04:00 committed by Shupeyko Nikita
parent d34aa71038
commit 4aff5971d1
6 changed files with 71 additions and 0 deletions

View File

@ -56,6 +56,7 @@ Listed in alphabetical order.
Areski Belaid `@areski`_ Areski Belaid `@areski`_
Ashley Camba Ashley Camba
Barclay Gauld `@yunti`_ Barclay Gauld `@yunti`_
Ben Warren `@bwarren2`
Ben Lopatin Ben Lopatin
Benjamin Abel Benjamin Abel
Bo Lopker `@blopker`_ Bo Lopker `@blopker`_

View File

@ -21,5 +21,6 @@
"postgresql_version": ["9.6", "9.5", "9.4", "9.3", "9.2"], "postgresql_version": ["9.6", "9.5", "9.4", "9.3", "9.2"],
"js_task_runner": ["Gulp", "Grunt", "None"], "js_task_runner": ["Gulp", "Grunt", "None"],
"use_lets_encrypt": "n", "use_lets_encrypt": "n",
"custom_bootstrap_compilation": "n",
"open_source_license": ["MIT", "BSD", "GPLv3", "Apache Software License 2.0", "Not open source"] "open_source_license": ["MIT", "BSD", "GPLv3", "Apache Software License 2.0", "Not open source"]
} }

View File

@ -60,6 +60,9 @@ module.exports = function (grunt) {
dev: { dev: {
options: { options: {
outputStyle: 'nested', outputStyle: 'nested',
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
includePaths: ['bower_components/bootstrap-sass/assets/stylesheets/bootstrap/'],
{% endif %}
sourceMap: false, sourceMap: false,
precision: 10 precision: 10
}, },
@ -70,6 +73,9 @@ module.exports = function (grunt) {
dist: { dist: {
options: { options: {
outputStyle: 'compressed', outputStyle: 'compressed',
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
includePaths: ['bower_components/bootstrap-sass/assets/stylesheets/bootstrap/'],
{% endif %}
sourceMap: false, sourceMap: false,
precision: 10 precision: 10
}, },

View File

@ -145,3 +145,12 @@ See detailed `cookiecutter-django Elastic Beanstalk documentation`_.
.. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-elastic-beanstalk.html .. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-elastic-beanstalk.html
{% endif %} {% endif %}
{% if cookiecutter.custom_bootstrap_compilation == "y" %}
Custom Bootstrap Compilation
^^^^^^
To get automatic Bootstrap recompilation with variables of your choice, install bootstrap sass (`bower install bootstrap-sass`) and tweak your variables in `static/sass/custom_bootstrap_vars`.
(You can find a list of available variables [in the bootstrap-sass source](https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_variables.scss), or get explanations on them in the [Bootstrap docs](https://getbootstrap.com/customize/).)
{% endif %}

View File

@ -1,3 +1,57 @@
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
@import "variables";
@import "custom_bootstrap_vars";
@import "mixins";
// Reset and dependencies
@import "normalize";
@import "print";
@import "glyphicons";
// Core CSS
@import "scaffolding";
@import "type";
@import "code";
@import "grid";
@import "tables";
@import "forms";
@import "buttons";
// Components
@import "component-animations";
@import "dropdowns";
@import "button-groups";
@import "input-groups";
@import "navs";
@import "navbar";
@import "breadcrumbs";
@import "pagination";
@import "pager";
@import "labels";
@import "badges";
@import "jumbotron";
@import "thumbnails";
@import "alerts";
@import "progress-bars";
@import "media";
@import "list-group";
@import "panels";
@import "responsive-embed";
@import "wells";
@import "close";
// Components w/ JavaScript
@import "modals";
@import "tooltip";
@import "popovers";
@import "carousel";
// Utility classes
@import "utilities";
@import "responsive-utilities";
{% endif %}
// project specific CSS goes here // project specific CSS goes here