Switch the cms over to using django-pipeline
This commit is contained in:
committed by
Matthew Mongeau
parent
4ddf48e1b2
commit
4cb285f1f9
@@ -23,6 +23,12 @@ import sys
|
||||
import tempfile
|
||||
from path import path
|
||||
|
||||
############################ FEATURE CONFIGURATION #############################
|
||||
|
||||
MITX_FEATURES = {
|
||||
'USE_DJANGO_PIPELINE': True,
|
||||
}
|
||||
|
||||
############################# SET PATH INFORMATION #############################
|
||||
PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /mitx/cms
|
||||
COMMON_ROOT = PROJECT_ROOT.dirname() / "common"
|
||||
@@ -43,7 +49,10 @@ sys.path.append(COMMON_ROOT / 'lib')
|
||||
# This is where we stick our compiled template files.
|
||||
MAKO_MODULE_DIR = tempfile.mkdtemp('mako')
|
||||
MAKO_TEMPLATES = {}
|
||||
MAKO_TEMPLATES['main'] = [PROJECT_ROOT / 'templates']
|
||||
MAKO_TEMPLATES['main'] = [
|
||||
PROJECT_ROOT / 'templates',
|
||||
COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates'
|
||||
]
|
||||
|
||||
MITX_ROOT_URL = ''
|
||||
|
||||
@@ -59,8 +68,8 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
# List of finder classes that know how to find static files in
|
||||
# various locations.
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
'staticfiles.finders.FileSystemFinder',
|
||||
'staticfiles.finders.AppDirectoriesFinder',
|
||||
)
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
@@ -132,14 +141,60 @@ USE_L10N = True
|
||||
# Messages
|
||||
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
|
||||
|
||||
############################### Pipeline #######################################
|
||||
|
||||
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
|
||||
|
||||
PIPELINE_CSS = {
|
||||
'base-style': {
|
||||
'source_filenames': ['sass/base-style.scss'],
|
||||
'output_filename': 'css/base-style.css',
|
||||
},
|
||||
}
|
||||
|
||||
PIPELINE_ALWAYS_RECOMPILE = ['sass/base-style.scss']
|
||||
|
||||
PIPELINE_JS = {
|
||||
}
|
||||
|
||||
PIPELINE_COMPILERS = [
|
||||
'pipeline.compilers.sass.SASSCompiler',
|
||||
'pipeline.compilers.coffee.CoffeeScriptCompiler',
|
||||
]
|
||||
|
||||
PIPELINE_SASS_ARGUMENTS = '-t compressed -r {proj_dir}/static/sass/bourbon/lib/bourbon.rb'.format(proj_dir=PROJECT_ROOT)
|
||||
|
||||
PIPELINE_CSS_COMPRESSOR = None
|
||||
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
|
||||
|
||||
STATICFILES_IGNORE_PATTERNS = (
|
||||
"sass/*",
|
||||
"coffee/*",
|
||||
"*.py",
|
||||
"*.pyc"
|
||||
)
|
||||
|
||||
PIPELINE_YUI_BINARY = 'yui-compressor'
|
||||
PIPELINE_SASS_BINARY = 'sass'
|
||||
PIPELINE_COFFEE_SCRIPT_BINARY = 'coffee'
|
||||
|
||||
# Setting that will only affect the MITx version of django-pipeline until our changes are merged upstream
|
||||
PIPELINE_COMPILE_INPLACE = True
|
||||
|
||||
############################ APPS #####################################
|
||||
|
||||
INSTALLED_APPS = (
|
||||
# Standard apps
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
# For CMS
|
||||
'contentstore',
|
||||
|
||||
# For asset pipelining
|
||||
'pipeline',
|
||||
'staticfiles',
|
||||
)
|
||||
|
||||
1
cms/static/sass/.gitignore
vendored
Normal file
1
cms/static/sass/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.css
|
||||
@@ -1,10 +1,16 @@
|
||||
<%namespace name='static' file='static_content.html'/>
|
||||
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
|
||||
% if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
|
||||
<%static:css group='base-style'/>
|
||||
% else:
|
||||
<link rel="stylesheet" href="${ STATIC_URL }/css/base-style.css">
|
||||
% endif
|
||||
<link rel="stylesheet" type="text/css" href="${ STATIC_URL }/js/markitup/skins/simple/style.css" />
|
||||
<link rel="stylesheet" type="text/css" href="${ STATIC_URL }/js/markitup/sets/wiki/style.css" />
|
||||
<title><%block name="title"></%block></title>
|
||||
|
||||
@@ -21,7 +21,7 @@ def compressed_css(package_name):
|
||||
return render_individual_css(package, paths)
|
||||
|
||||
def render_css(package, path):
|
||||
template_name = package.template_name or "pipeline_mako/css.html"
|
||||
template_name = package.template_name or "mako/css.html"
|
||||
context = package.extra_context
|
||||
context.update({
|
||||
'type': guess_type(path, 'text/css'),
|
||||
@@ -50,7 +50,7 @@ def compressed_js(package_name):
|
||||
return render_individual_js(package, paths, templates)
|
||||
|
||||
def render_js(package, path):
|
||||
template_name = package.template_name or "pipeline_mako/js.html"
|
||||
template_name = package.template_name or "mako/js.html"
|
||||
context = package.extra_context
|
||||
context.update({
|
||||
'type': guess_type(path, 'text/javascript'),
|
||||
@@ -63,7 +63,7 @@ def render_inline_js(package, js):
|
||||
context.update({
|
||||
'source': js
|
||||
})
|
||||
return render_to_string("pipeline_mako/inline_js.html", context)
|
||||
return render_to_string("mako/inline_js.html", context)
|
||||
|
||||
def render_individual_js(package, paths, templates=None):
|
||||
tags = [render_js(package, js) for js in paths]
|
||||
@@ -73,7 +73,9 @@ MAKO_TEMPLATES['course'] = [DATA_DIR]
|
||||
MAKO_TEMPLATES['sections'] = [DATA_DIR / 'sections']
|
||||
MAKO_TEMPLATES['custom_tags'] = [DATA_DIR / 'custom_tags']
|
||||
MAKO_TEMPLATES['main'] = [PROJECT_ROOT / 'templates',
|
||||
COMMON_ROOT / 'templates',
|
||||
COMMON_ROOT / 'lib' / 'capa' / 'templates',
|
||||
COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates',
|
||||
DATA_DIR / 'info',
|
||||
DATA_DIR / 'problems']
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ python-memcached
|
||||
django-celery
|
||||
path.py
|
||||
django_debug_toolbar
|
||||
-e git+git://github.com/MITx/django-pipeline.git@incremental_compile#egg=django-pipeline
|
||||
-e git+git://github.com/MITx/django-pipeline.git#egg=django-pipeline
|
||||
django-staticfiles>=1.2.1
|
||||
django-masquerade
|
||||
fs
|
||||
|
||||
Reference in New Issue
Block a user