Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Fix broken theming (#709)
Browse files Browse the repository at this point in the history
* Dynamic require theme scss from env var

* Update README about THEME_SCSS. Try to fix tests.

* Fix broken karma webpack config

* Fix THEME_SCSS defaulting in webpack config
  • Loading branch information
thallada authored Jul 18, 2017
1 parent cfdbb39 commit f4e76a7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ Theming and Branding
We presently have support for basic branding of the logo displayed in the header and on error pages. This is facilitated
by including an additional SCSS file specifying the path and dimensions of the logo. The default Open edX theme located
at `static/sass/themes/open-edx.scss` is a good starting point for those interested in changing the logo. Once your
customizations are complete, update the value of the setting `THEME_SCSS` with the path to your new SCSS file.
customizations are complete, update the value of the yaml configuration setting `INSIGHTS_THEME_SCSS` with the path to
your new SCSS file. If running Webpack manually, you will have to set the environmental variable `THEME_SCSS` to your
file before running Webpack.

Developers may also choose to further customize the site by changing the variables loaded by SCSS. This is most easily
accomplished via the steps below. This will allow for easily changing basic colors and spacing.
Expand Down
6 changes: 0 additions & 6 deletions analytics_dashboard/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,6 @@
DOCS_CONFIG.readfp(config_file)
########## END DOCS/HELP CONFIGURATION


########## THEME CONFIGURATION
# Path of the SCSS file to use for the site's theme
THEME_SCSS = 'sass/themes/open-edx.scss'
########## END THEME CONFIGURATION

########## COURSE API
COURSE_API_URL = None
GRADING_POLICY_API_URL = None
Expand Down
2 changes: 1 addition & 1 deletion analytics_dashboard/static/js/application-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Load scripts needed across the application.
*/
require('sass/style-application.scss');
require('sass/themes/open-edx.scss');
require(process.env.THEME_SCSS);

require(['views/data-table-view',
'views/announcement-view',
Expand Down
7 changes: 7 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var path = require('path'),

module.exports = function(config) {
'use strict';

config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
Expand Down Expand Up @@ -141,6 +142,12 @@ module.exports = function(config) {
// the text so tests can be run if modules reference gettext
gettext: 'test/browser-shims/gettext',
ngettext: 'test/browser-shims/ngettext'
}),
// This defines the theme that the SCSS should be building with. For test, this is always open-edx
new webpack.DefinePlugin({
'process.env': {
THEME_SCSS: 'sass/themes/open-edx.scss'
}
})
]
},
Expand Down
6 changes: 6 additions & 0 deletions webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ module.exports = {
$: 'jquery',
jQuery: 'jquery'
}),
// This defines the theme that the SCSS should be building with
new webpack.DefinePlugin({
'process.env': {
'THEME_SCSS': JSON.stringify(process.env.THEME_SCSS || 'sass/themes/open-edx.scss')
}
}),
// AggressiveMergingPlugin in conjunction with these CommonChunkPlugins turns many GBs worth of individual
// chunks into one or two large chunks that entry chunks reference. It reduces output bundle size a lot.
new webpack.optimize.AggressiveMergingPlugin({minSizeReduce: 1.1}),
Expand Down

0 comments on commit f4e76a7

Please sign in to comment.