Commit Graph

10 Commits

Author SHA1 Message Date
Calen Pennington
6b68f2c0fe Use coffee watch command to watch whole directories, so that it will pick up new coffee files as they are created 2013-06-04 12:52:56 -04:00
Nate Hardison
03a9765b79 Change task.invoke to Rake::Task.invoke
Using `task()` reopens the definition of the task, and all we really
need to do is get a reference to the task itself to invoke it.
2013-06-03 10:00:50 -07:00
Nate Hardison
1001b315a3 Preprocess assets as Django management command
Rather than directly invoke command-line Python (and Mako) from the
assets Rakefile, or call an external Python script, use a Django
management command to preprocess all asset template files.

An "asset template file" is defined as a static asset file with a
file extension indicating that it needs to be run through a template
engine prior to Sass/CoffeeScript compilation or packaging with other
assets. The preprocess_assets management command will look through
all of the files listed in the `STATICFILES_DIRS`, preprocessing each
as needed. Preprocessing strips off the special template file
extension, creating a new file in the process.

Currently, the only variable accessible in an asset template file is
the `THEME_NAME`, defined in the settings.
2013-06-03 09:58:01 -07:00
Chris Dodge
4c97d16edc add hack to assets.rake to unblock the release train 2013-05-28 23:40:16 -04:00
Nate Hardison
daa0ac2f01 Capture Mako exit code and fail fast if necessary
Capture the exit code of the Mako template engine invocation on
asset preprocessing and abort from the Rake task on failure. This
will prevent the LMS from continuing its attempt to start up,
preventing further configuration errors.
2013-05-22 19:42:22 -07:00
Nate Hardison
185ab4c35c Make Mako preprocessing a Rake task
Per feedback from @cpennington. This way we'll only preprocess once,
even if the Sass compilation is invoked multiple times.
2013-05-22 12:22:28 -07:00
Nate Hardison
ea3506d2b9 Add general theming capabilities
This commit adds the requisite settings and startup features to
enable integration of themes into the edX platform. It does not
yet provide hooks in any of the templates, but it does cause the
main `lms/static/sass/application.scss` file to `@import` a theme's
base Sass. Template hooks will come down the road.

CHANGELOG
---------
Define a new `MITX_FEATURE`, `USE_CUSTOM_THEME`, that when enabled,
can be used in templates to determine whether or not custom theme
templates should be used instead of the defaults.

Also define a new setting, `THEME_NAME`, which will be used to
locate theme-specific files. Establish the convention that themes
will be stored outside of the `REPO_ROOT`, inside the `ENV_ROOT`,
in a directory named `themes/`. `themes/<THEME_NAME>` will store
the files for a particular theme.

Provide a function, `enable_theme`, that modifies the template and
static asset load paths appropriately to include the theme's files.

Move the main LMS Sass file to a Mako template that conditionally
`@import`s the theme's base Sass file when a theme is enabled.

Add logic to the assets Rakefile to properly preprocess any Sass/
Mako templates before compiling them.
2013-05-22 12:22:27 -07:00
Calen Pennington
280f09739f Batched coffee --watch compilation in smaller batches
This is to work around an OSx issue that causes EMFILE errors in the
default configuration.
Ref: https://github.com/joyent/node/issues/2479
2013-05-17 14:22:01 -04:00
Calen Pennington
b5c134e21e Make the externally facing asset watch commands wait for user intervention, and add internal tasks that only run as long as the rake process 2013-05-15 15:25:42 -04:00
Calen Pennington
9d42bce54f Split rake file into smaller, more manageable pieces 2013-05-15 15:25:35 -04:00