diff --git a/cms/static/sass/_variables.scss b/cms/static/sass/_variables.scss index f506473028..ad20b57221 100644 --- a/cms/static/sass/_variables.scss +++ b/cms/static/sass/_variables.scss @@ -2,6 +2,7 @@ // ==================== // Table of Contents +// * +Paths // * +Grid // * +Fonts // * +Colors - Utility @@ -11,11 +12,14 @@ // * +Timing // * +Archetype UI // * +Specific UI -// * +Paths // * +Deprecated $baseline: 20px; +// +Paths +// ==================== +$static-path: '..' !default; + // +Grid // ==================== $gw-column: ($baseline*3); @@ -214,10 +218,6 @@ $ui-link-color-focus: $blue-s1; $ui-notification-height: ($baseline*10); $ui-update-color: $blue-l4; -// +Paths -// ==================== -$static-path: '..' !default; - // +Deprecated // ==================== // do not use, future clean up will use updated styles diff --git a/common/djangoapps/edxmako/management/commands/preprocess_assets.py b/common/djangoapps/edxmako/management/commands/preprocess_assets.py index be2fc0ffb1..805981327e 100644 --- a/common/djangoapps/edxmako/management/commands/preprocess_assets.py +++ b/common/djangoapps/edxmako/management/commands/preprocess_assets.py @@ -37,9 +37,9 @@ class Command(BaseCommand): def process_one_file(self, source_file, dest_dir, theme_name): """Pre-process a .scss file to replace our markers with real code.""" with open(source_file) as fsource: - original_content = content = fsource.read() + original_content = fsource.read() - content = content.replace( + content = original_content.replace( "//", "@import '{}';".format(theme_name), ) diff --git a/lms/static/sass/lms-course-rtl.scss b/lms/static/sass/lms-course-rtl.scss index b2935badb2..47c0dcda71 100644 --- a/lms/static/sass/lms-course-rtl.scss +++ b/lms/static/sass/lms-course-rtl.scss @@ -6,6 +6,8 @@ @import 'base/font_face'; @import 'base/mixins'; +// This comment is used by preprocess_assets.py to include resources from a +// theme, for old-style deprecated theming. // @import 'build-course'; // shared app style assets/rendering diff --git a/lms/static/sass/lms-course.scss b/lms/static/sass/lms-course.scss index c2324b725f..53ecb202e2 100644 --- a/lms/static/sass/lms-course.scss +++ b/lms/static/sass/lms-course.scss @@ -6,6 +6,8 @@ @import 'base/font_face'; @import 'base/mixins'; +// This comment is used by preprocess_assets.py to include resources from a +// theme, for old-style deprecated theming. // @import 'build-course'; // shared app style assets/rendering diff --git a/lms/static/sass/lms-footer-rtl.scss b/lms/static/sass/lms-footer-rtl.scss index 9da0a77db2..218aa1f964 100644 --- a/lms/static/sass/lms-footer-rtl.scss +++ b/lms/static/sass/lms-footer-rtl.scss @@ -9,6 +9,8 @@ @import 'base/variables'; @import 'base/mixins'; +// This comment is used by preprocess_assets.py to include resources from a +// theme, for old-style deprecated theming. // footer#footer-openedx { diff --git a/lms/static/sass/lms-footer.scss b/lms/static/sass/lms-footer.scss index 7bba0241a1..ba292cc8e9 100644 --- a/lms/static/sass/lms-footer.scss +++ b/lms/static/sass/lms-footer.scss @@ -9,6 +9,8 @@ @import 'base/variables'; @import 'base/mixins'; +// This comment is used by preprocess_assets.py to include resources from a +// theme, for old-style deprecated theming. // footer#footer-openedx { diff --git a/lms/static/sass/lms-main-rtl.scss b/lms/static/sass/lms-main-rtl.scss index e49e104e40..7ab3e3cd35 100644 --- a/lms/static/sass/lms-main-rtl.scss +++ b/lms/static/sass/lms-main-rtl.scss @@ -14,6 +14,8 @@ @import 'base/variables'; @import 'base/mixins'; +// This comment is used by preprocess_assets.py to include resources from a +// theme, for old-style deprecated theming. // @import 'build-lms'; // shared app style assets/rendering diff --git a/lms/static/sass/lms-main.scss b/lms/static/sass/lms-main.scss index c7f53398c3..1a79ca0442 100644 --- a/lms/static/sass/lms-main.scss +++ b/lms/static/sass/lms-main.scss @@ -13,6 +13,8 @@ @import 'base/variables'; @import 'base/mixins'; +// This comment is used by preprocess_assets.py to include resources from a +// theme, for old-style deprecated theming. // @import 'build-lms'; // shared app style assets/rendering diff --git a/openedx/core/djangoapps/theming/startup.py b/openedx/core/djangoapps/theming/startup.py index cc10748dbb..ae217804b7 100644 --- a/openedx/core/djangoapps/theming/startup.py +++ b/openedx/core/djangoapps/theming/startup.py @@ -2,6 +2,7 @@ Startup code for Comprehensive Theming """ +from path import Path as path from django.conf import settings from .core import enable_comprehensive_theme @@ -10,4 +11,4 @@ from .core import enable_comprehensive_theme def run(): """Enable comprehensive theming, if we should.""" if settings.COMP_THEME_DIR: - enable_comprehensive_theme(theme_dir=settings.COMP_THEME_DIR) + enable_comprehensive_theme(theme_dir=path(settings.COMP_THEME_DIR)) diff --git a/themes/README.rst b/themes/README.rst index 6df4d0d884..cf67636447 100644 --- a/themes/README.rst +++ b/themes/README.rst @@ -38,7 +38,7 @@ edx-platform. Here's a sample:: The top directory is named whatever you like. This example uses "my-theme". The files provided here override the files in edx-platform. In this case, the ``my-theme/lms/static/sass/lms-main.scss`` file is used in place of the -``edx-platform/lms/static/lms-main.scss`` file. +``edx-platform/lms/static/sass/lms-main.scss`` file. Images @@ -66,9 +66,9 @@ The variables that can currently be overridden are defined in **Note:** We are currently in the middle of a re-engineering of the Sass variables. They will change in the future. If you are interested, you can see -the new development in the `edX Pattern Library`__. +the new development in the `edX Pattern Library`_. -.. __: http://ux.edx.org/ +.. _edX Pattern Library: http://ux.edx.org/ Then create ``lms/static/sass/lms-main.scss`` to use those overrides, and also the rest of the definitions from the original file:: @@ -94,18 +94,28 @@ copied template in your theme also. Installing your theme --------------------- -To use your theme, follow these steps: +To use your theme, you need to add a configuration value pointing to your theme +directory. There are two ways to do this. -#. Edit /edx/app/edx_ansible/server-vars.yml to add the edxapp_comp_theme_dir - value:: +#. If you usually edit server-vars.yml: - edxapp_comp_theme_dir: '/full/path/to/my-theme' + #. As the vagrant user, edit (or create) + /edx/app/edx_ansible/server-vars.yml to add the + ``edxapp_comp_theme_dir`` value:: -#. Re-run the provisioning script:: + edxapp_comp_theme_dir: '/full/path/to/my-theme' - $ sudo /edx/bin/update edx-platform HEAD + #. Run the update script:: -Your changes should now be visible on your site. + $ sudo /edx/bin/update configuration master + $ sudo /edx/bin/update edx-platform HEAD + +#. Otherwise, edit the /edx/app/edxapp/lms.env.json file to add the + ``COMP_THEME_DIR`` value:: + + "COMP_THEME_DIR": "/full/path/to/my-theme", + +Restart your site. Your changes should now be visible. "Stanford" theming