Skip to content

Commit

Permalink
Replace vendored theme CSS with bower package support
Browse files Browse the repository at this point in the history
Gulp will copy these files into our vendored sources from now on,
installing from the sphinx_rtd_theme github repo.
  • Loading branch information
agjohnson committed Sep 10, 2015
1 parent 27f831f commit c9c17ee
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
1 change: 1 addition & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"jquery": "~2.0.3",
"underscore": "~1.7.0",
"readthedocs-client": "https://github.com/agjohnson/readthedocs-client-js.git",
"sphinx-rtd-theme": "https://github.com/snide/sphinx-rtd-theme.git#js-refactor",
"knockout": "~3.3.0",
"jquery.payment": "~1.2.3",
"jquery-migrate": "~1.2.1",
Expand Down
24 changes: 20 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var gulp = require('gulp'),
gulp_util = require('gulp-util'),
watch = require('gulp-watch'),
rename = require('gulp-rename'),
run = require('gulp-run'),
less = require('gulp-less'),
bower_resolve = require('bower-resolve'),
Expand All @@ -22,6 +23,8 @@ var sources = {
'js/readthedocs-doc-embed.js': {expose: false},
'js/autocomplete.js': {},
'js/projectimport.js': {},
'css/badge_only.css': {src: 'bower_components/sphinx-rtd-theme/sphinx_rtd_theme/static/css/badge_only.css'},
'css/theme.css': {src: 'bower_components/sphinx-rtd-theme/sphinx_rtd_theme/static/css/theme.css'}
},
projects: {'js/tools.js': {}},
gold: {'js/gold.js': {}},
Expand All @@ -42,10 +45,10 @@ var standalone = {
// application. This is called by build and dev tasks.
function build_app_sources (application, minify) {
// Normalize file glob lists
var bundles = Object.keys(sources[application]).map(function (n) {
var bundles = Object.keys(sources[application]).map(function (entry_path) {
var bundle_path = path.join(
pkg_config.name, application, 'static-src', '**', n),
bundle_config = sources[application][n] || {},
pkg_config.name, application, 'static-src', '**', entry_path),
bundle_config = sources[application][entry_path] || {},
bundle;

if (/\.js$/.test(bundle_path)) {
Expand Down Expand Up @@ -79,14 +82,27 @@ function build_app_sources (application, minify) {
}
}
else if (/\.less$/.test(bundle_path)) {
// CSS sources
// LESS sources
bundle = gulp.src(bundle_path)
.pipe(less({}))
.on('error', function (ev) {
gulp_util.beep();
gulp_util.log('LESS error:', ev.message);
});
}
else {
// Copy only sources, from bower_components/etc
var bundle = gulp;
if (bundle_config.src) {
bundle = bundle
.src(bundle_config.src)
.pipe(rename(application + path.sep + entry_path));
}
else {
bundle = bundle
.src(bundle_path);
}
}

return bundle;
});
Expand Down
2 changes: 0 additions & 2 deletions media/css/badge_only.css

This file was deleted.

1 change: 1 addition & 0 deletions media/css/badge_only.css
5 changes: 0 additions & 5 deletions media/css/sphinx_rtd_theme.css

This file was deleted.

1 change: 1 addition & 0 deletions media/css/sphinx_rtd_theme.css
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"event-stream": "^3.3.1",
"gulp": "*",
"gulp-less": "^3.0.3",
"gulp-rename": "^1.2.2",
"gulp-run": "^1.6.6",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.3",
Expand Down
2 changes: 2 additions & 0 deletions readthedocs/core/static/core/css/badge_only.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions readthedocs/core/static/core/css/theme.css

Large diffs are not rendered by default.

0 comments on commit c9c17ee

Please sign in to comment.