diff --git a/cms/envs/common.py b/cms/envs/common.py index 886ab13887..04dfd04fdc 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -478,15 +478,16 @@ PIPELINE_CSS = { 'output_filename': 'css/cms-style-vendor-tinymce-skin.css', }, 'style-main': { + # this is unnecessary and can be removed 'source_filenames': [ - 'sass/studio-main.css', - 'css/edx-cc.css', + 'css/studio-main.css', ], 'output_filename': 'css/studio-main.css', }, 'style-main-rtl': { + # this is unnecessary and can be removed 'source_filenames': [ - 'sass/studio-main-rtl.css', + 'css/studio-main-rtl.css', ], 'output_filename': 'css/studio-main-rtl.css', }, diff --git a/common/static/fonts/edx-cc/edx-cc.eot b/cms/static/fonts/CreativeCommons/cc.eot similarity index 100% rename from common/static/fonts/edx-cc/edx-cc.eot rename to cms/static/fonts/CreativeCommons/cc.eot diff --git a/common/static/fonts/edx-cc/edx-cc.svg b/cms/static/fonts/CreativeCommons/cc.svg similarity index 100% rename from common/static/fonts/edx-cc/edx-cc.svg rename to cms/static/fonts/CreativeCommons/cc.svg diff --git a/common/static/fonts/edx-cc/edx-cc.ttf b/cms/static/fonts/CreativeCommons/cc.ttf similarity index 100% rename from common/static/fonts/edx-cc/edx-cc.ttf rename to cms/static/fonts/CreativeCommons/cc.ttf diff --git a/common/static/fonts/edx-cc/edx-cc.woff b/cms/static/fonts/CreativeCommons/cc.woff similarity index 100% rename from common/static/fonts/edx-cc/edx-cc.woff rename to cms/static/fonts/CreativeCommons/cc.woff diff --git a/cms/static/sass/_build.scss b/cms/static/sass/_build.scss index f3a2333c61..303861279e 100644 --- a/cms/static/sass/_build.scss +++ b/cms/static/sass/_build.scss @@ -44,6 +44,7 @@ @import 'elements/vendor'; // overrides to vendor-provided styling @import 'elements/modal-window'; @import 'elements/uploaded-assets'; // layout for asset tables +@import 'elements/creative-commons'; // +Base - Specific Views // ==================== diff --git a/common/static/css/edx-cc.css b/cms/static/sass/elements/_creative-commons.scss similarity index 63% rename from common/static/css/edx-cc.css rename to cms/static/sass/elements/_creative-commons.scss index 473498a935..d14351f83b 100644 --- a/common/static/css/edx-cc.css +++ b/cms/static/sass/elements/_creative-commons.scss @@ -1,16 +1,16 @@ @font-face { - font-family: 'edx-cc'; - src: url('../fonts/edx-cc/edx-cc.eot?52318265'); - src: url('../fonts/edx-cc/edx-cc.eot?52318265#iefix') format('embedded-opentype'), - url('../fonts/edx-cc/edx-cc.woff?52318265') format('woff'), - url('../fonts/edx-cc/edx-cc.ttf?52318265') format('truetype'), - url('../fonts/edx-cc/edx-cc.svg?52318265#edx-cc') format('svg'); + font-family: 'CreativeCommons'; + src: url('../fonts/CreativeCommons/cc.eot'); + src: url('../fonts/CreativeCommons/cc.eot#iefix') format('embedded-opentype'), + url('../fonts/CreativeCommons/cc.woff') format('woff'), + url('../fonts/CreativeCommons/cc.ttf') format('truetype'), + url('../fonts/CreativeCommons/cc.svg#CreativeCommons') format('svg'); font-weight: normal; font-style: normal; } [class^="icon-cc"]:before, [class*=" icon-cc"]:before { - font-family: "edx-cc"; + font-family: "CreativeCommons"; } .icon-cc:before { content: '\e800'; } /* '' */ diff --git a/lms/envs/common.py b/lms/envs/common.py index cb28ac68bb..05e97a1ea9 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1339,16 +1339,16 @@ PIPELINE_CSS = { 'output_filename': 'css/lms-style-vendor-tinymce-skin.css', }, 'style-main': { + # this is unnecessary and can be removed 'source_filenames': [ - 'sass/lms-main.css', - 'css/edx-cc.css', + 'css/lms-main.css', ], 'output_filename': 'css/lms-main.css', }, 'style-main-rtl': { + # this is unnecessary and can be removed 'source_filenames': [ - 'sass/lms-main-rtl.css', - 'css/edx-cc.css', + 'css/lms-main-rtl.css', ], 'output_filename': 'css/lms-main-rtl.css', }, @@ -1362,7 +1362,7 @@ PIPELINE_CSS = { }, 'style-course': { 'source_filenames': [ - 'sass/lms-course.css', + 'css/lms-course.css', 'xmodule/modules.css', ], 'output_filename': 'css/lms-course.css', diff --git a/lms/static/fonts/CreativeCommons/cc.eot b/lms/static/fonts/CreativeCommons/cc.eot new file mode 100644 index 0000000000..3c652cc929 Binary files /dev/null and b/lms/static/fonts/CreativeCommons/cc.eot differ diff --git a/lms/static/fonts/CreativeCommons/cc.svg b/lms/static/fonts/CreativeCommons/cc.svg new file mode 100644 index 0000000000..5539ab8b0f --- /dev/null +++ b/lms/static/fonts/CreativeCommons/cc.svg @@ -0,0 +1,22 @@ + + + +Copyright (C) 2014 by original authors @ fontello.com + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lms/static/fonts/CreativeCommons/cc.ttf b/lms/static/fonts/CreativeCommons/cc.ttf new file mode 100644 index 0000000000..3bde4e7c92 Binary files /dev/null and b/lms/static/fonts/CreativeCommons/cc.ttf differ diff --git a/lms/static/fonts/CreativeCommons/cc.woff b/lms/static/fonts/CreativeCommons/cc.woff new file mode 100644 index 0000000000..bc6dd7a828 Binary files /dev/null and b/lms/static/fonts/CreativeCommons/cc.woff differ diff --git a/lms/static/sass/_build-lms.scss b/lms/static/sass/_build-lms.scss index c5f95fe8bf..d42005f107 100644 --- a/lms/static/sass/_build-lms.scss +++ b/lms/static/sass/_build-lms.scss @@ -16,6 +16,7 @@ @import 'elements/typography'; @import 'elements/controls'; @import 'elements/system-feedback'; +@import 'elements/creative-commons'; // shared - course @import 'shared/fields'; diff --git a/lms/static/sass/elements/_creative-commons.scss b/lms/static/sass/elements/_creative-commons.scss new file mode 100644 index 0000000000..d14351f83b --- /dev/null +++ b/lms/static/sass/elements/_creative-commons.scss @@ -0,0 +1,26 @@ +@font-face { + font-family: 'CreativeCommons'; + src: url('../fonts/CreativeCommons/cc.eot'); + src: url('../fonts/CreativeCommons/cc.eot#iefix') format('embedded-opentype'), + url('../fonts/CreativeCommons/cc.woff') format('woff'), + url('../fonts/CreativeCommons/cc.ttf') format('truetype'), + url('../fonts/CreativeCommons/cc.svg#CreativeCommons') format('svg'); + font-weight: normal; + font-style: normal; +} + +[class^="icon-cc"]:before, [class*=" icon-cc"]:before { + font-family: "CreativeCommons"; +} + +.icon-cc:before { content: '\e800'; } /* '' */ +.icon-cc-by:before { content: '\e801'; } /* '' */ +.icon-cc-nc:before { content: '\e802'; } /* '' */ +.icon-cc-nc-eu:before { content: '\e803'; } /* '' */ +.icon-cc-nc-jp:before { content: '\e804'; } /* '' */ +.icon-cc-sa:before { content: '\e805'; } /* '' */ +.icon-cc-nd:before { content: '\e806'; } /* '' */ +.icon-cc-pd:before { content: '\e807'; } /* '' */ +.icon-cc-zero:before { content: '\e808'; } /* '' */ +.icon-cc-share:before { content: '\e809'; } /* '' */ +.icon-cc-remix:before { content: '\e80a'; } /* '' */ diff --git a/pavelib/assets.py b/pavelib/assets.py index 5653301647..6b0541c30f 100644 --- a/pavelib/assets.py +++ b/pavelib/assets.py @@ -15,21 +15,22 @@ from .utils.cmd import cmd, django_cmd # setup baseline paths COFFEE_DIRS = ['lms', 'cms', 'common'] -SASS_LOAD_PATHS = ['./common/static/sass'] -SASS_UPDATE_DIRS = ['*/static'] +SASS_DIRS = { + "lms/static/sass": "lms/static/css", + "cms/static/sass": "cms/static/css", + "common/static/sass": "common/static/css", +} +SASS_LOAD_PATHS = ['common/static', 'common/static/sass'] SASS_CACHE_PATH = '/tmp/sass-cache' -THEME_COFFEE_PATHS = [] -THEME_SASS_PATHS = [] - edxapp_env = Env() if edxapp_env.feature_flags.get('USE_CUSTOM_THEME', False): theme_name = edxapp_env.env_tokens.get('THEME_NAME', '') parent_dir = path(edxapp_env.REPO_ROOT).abspath().parent theme_root = parent_dir / "themes" / theme_name - THEME_COFFEE_PATHS = [theme_root] - THEME_SASS_PATHS = [theme_root / "static" / "sass"] + COFFEE_DIRS.append(theme_root) + SASS_DIRS[theme_root / "static" / "sass"] = None class CoffeeScriptWatcher(PatternMatchingEventHandler): @@ -69,7 +70,7 @@ class SassWatcher(PatternMatchingEventHandler): """ register files with observer """ - for dirname in SASS_LOAD_PATHS + SASS_UPDATE_DIRS + THEME_SASS_PATHS: + for dirname in SASS_LOAD_PATHS + SASS_DIRS.keys(): paths = [] if '*' in dirname: paths.extend(glob.glob(dirname)) @@ -111,7 +112,7 @@ def coffeescript_files(): """ return find command for paths containing coffee files """ - dirs = " ".join(THEME_COFFEE_PATHS + [Env.REPO_ROOT / coffee_dir for coffee_dir in COFFEE_DIRS]) + dirs = " ".join([Env.REPO_ROOT / coffee_dir for coffee_dir in COFFEE_DIRS]) return cmd('find', dirs, '-type f', '-name \"*.coffee\"') @@ -134,13 +135,24 @@ def compile_sass(debug=False): """ Compile Sass to CSS. """ - sh(cmd( - 'sass', '' if debug else '--style compressed', - "--sourcemap" if debug else '', - "--cache-location {cache}".format(cache=SASS_CACHE_PATH), - "--load-path", " ".join(SASS_LOAD_PATHS + THEME_SASS_PATHS), - "--update", "-E", "utf-8", " ".join(SASS_UPDATE_DIRS + THEME_SASS_PATHS), - )) + parts = ["sass"] + parts.append("--update") + parts.append("--cache-location {cache}".format(cache=SASS_CACHE_PATH)) + parts.append("--default-encoding utf-8") + if debug: + parts.append("--sourcemap") + else: + parts.append("--style compressed") + for load_path in SASS_LOAD_PATHS + SASS_DIRS.keys(): + parts.append("--load-path {path}".format(path=load_path)) + + for sass_dir, css_dir in SASS_DIRS.items(): + if css_dir: + parts.append("{sass}:{css}".format(sass=sass_dir, css=css_dir)) + else: + parts.append(sass_dir) + + sh(cmd(*parts)) def compile_templated_sass(systems, settings):