Merge branch 'master' into style-cpp-domain

This commit is contained in:
Anthony Johnson 2019-07-25 18:11:13 -06:00
commit 10d9f512ad
41 changed files with 249 additions and 328 deletions

View File

@ -1,189 +0,0 @@
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
// Read package.json
pkg: grunt.file.readJSON("package.json"),
open : {
dev: {
path: 'http://localhost:1919'
}
},
connect: {
server: {
options: {
port: 1919,
base: 'docs/build',
livereload: true
}
}
},
copy: {
fonts: {
files: [
{
expand: true,
flatten: true,
src: ['bower_components/font-awesome/fonts/*'],
dest: 'sphinx_rtd_theme/static/fonts/',
filter: 'isFile'
},
{
expand: true,
flatten: true,
src: ['fonts/Lato/*'],
dest: 'sphinx_rtd_theme/static/fonts/Lato',
filter: 'isFile'
},
{
expand: true,
flatten: true,
src: ['fonts/RobotoSlab/*'],
dest: 'sphinx_rtd_theme/static/fonts/RobotoSlab/',
filter: 'isFile'
}
]
}
},
sass: {
dev: {
options: {
style: 'expanded',
loadPath: ['bower_components/bourbon/dist', 'bower_components/neat/app/assets/stylesheets', 'bower_components/font-awesome/scss', 'bower_components/wyrm/sass']
},
files: [{
expand: true,
cwd: 'sass',
src: ['*.sass'],
dest: 'sphinx_rtd_theme/static/css',
ext: '.css'
}]
},
build: {
options: {
style: 'compressed',
sourcemap: 'none',
loadPath: ['bower_components/bourbon/dist', 'bower_components/neat/app/assets/stylesheets', 'bower_components/font-awesome/scss', 'bower_components/wyrm/sass']
},
files: [{
expand: true,
cwd: 'sass',
src: ['*.sass'],
dest: 'sphinx_rtd_theme/static/css',
ext: '.css'
}]
}
},
browserify: {
dev: {
options: {
external: ['jquery'],
alias: {
'sphinx-rtd-theme': './js/theme.js'
}
},
src: ['js/*.js'],
dest: 'sphinx_rtd_theme/static/js/theme.js'
},
build: {
options: {
external: ['jquery'],
alias: {
'sphinx-rtd-theme': './js/theme.js'
}
},
src: ['js/*.js'],
dest: 'sphinx_rtd_theme/static/js/theme.js'
}
},
uglify: {
dist: {
options: {
sourceMap: false,
mangle: {
reserved: ['jQuery'] // Leave 'jQuery' identifier unchanged
},
ie8: true // compliance with IE 6-8 quirks
},
files: [{
expand: true,
src: ['sphinx_rtd_theme/static/js/*.js', '!sphinx_rtd_theme/static/js/*.min.js'],
dest: 'sphinx_rtd_theme/static/js/',
rename: function (dst, src) {
// Use unminified file name for minified file
return src;
}
}]
}
},
usebanner: {
dist: {
options: {
position: 'top',
banner: '/* <%= pkg.name %> version <%= pkg.version %> | MIT license */\n' +
'/* Built <%= grunt.template.today("yyyymmdd HH:mm") %> */',
linebreak: true
},
files: {
src: [ 'sphinx_rtd_theme/static/js/theme.js', 'sphinx_rtd_theme/static/css/theme.css' ]
}
}
},
exec: {
bower_update: {
cmd: 'bower update'
},
build_sphinx: {
cmd: 'sphinx-build docs/ docs/build'
}
},
clean: {
build: ["docs/build"],
fonts: ["sphinx_rtd_theme/static/fonts"],
css: ["sphinx_rtd_theme/static/css"],
js: ["sphinx_rtd_theme/static/js/*", "!sphinx_rtd_theme/static/js/modernizr.min.js"]
},
watch: {
/* Compile sass changes into theme directory */
sass: {
files: ['sass/*.sass', 'bower_components/**/*.sass'],
tasks: ['sass:dev']
},
/* Changes in theme dir rebuild sphinx */
sphinx: {
files: ['sphinx_rtd_theme/**/*', 'README.rst', 'docs/**/*.rst', 'docs/**/*.py'],
tasks: ['clean:build','exec:build_sphinx']
},
/* JavaScript */
browserify: {
files: ['js/*.js'],
tasks: ['browserify:dev']
},
/* live-reload the docs if sphinx re-builds */
livereload: {
files: ['docs/build/**/*'],
options: { livereload: true }
}
}
});
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('default', ['exec:bower_update','clean','copy:fonts','sass:dev','browserify:dev','usebanner','exec:build_sphinx','connect','open','watch']);
grunt.registerTask('build', ['exec:bower_update','clean','copy:fonts','sass:build','browserify:build','uglify','usebanner','exec:build_sphinx']);
}

View File

@ -1,37 +0,0 @@
{
"name": "sphinx-rtd-theme",
"version": "0.4.3",
"homepage": "https://github.com/rtfd/sphinx_rtd_theme",
"authors": [
"Dave Snider, Read the Docs, Inc. & contributors <dev@readthedocs.org>"
],
"description": "Sphinx theme for readthedocs.org.",
"license": "MIT",
"main": [
"js/theme.js"
],
"ignore": [
"docs",
".gitignore",
".DS_Store",
".sass-cache*",
".bowerrc",
"bower.json",
"package.json",
"Gruntfile.js",
"node_modules",
"bower_components",
"test",
"tests",
"src"
],
"devDependencies": {
"wyrm": "~1.0.x"
},
"dependencies": {
"font-awesome": "~4.7"
},
"resolutions": {
"font-awesome": "~4.7"
}
}

View File

@ -19,6 +19,7 @@ Other Changes
* Add the ``navigation`` template block around the navigation area. * Add the ``navigation`` template block around the navigation area.
* Added Spanish translation * Added Spanish translation
* Added i18n support using Babel * Added i18n support using Babel
* Moved build system from Grunt and friends to Webpack
0.4.3 0.4.3
====== ======

View File

@ -10,13 +10,12 @@ Modifying the theme
=================== ===================
The styles for this theme use SASS_ and a custom CSS framework called Wyrm_. We The styles for this theme use SASS_ and a custom CSS framework called Wyrm_. We
use Bower_ to manage these dependencies and SASS_ to build the CSS. Grunt_ is use Webpack_ and node-sass_ to build the CSS. Webpack_ is used to watch for
used to watch for changes, rebuild the static assets, and rebuild the Sphinx changes, rebuild the static assets, and rebuild the Sphinx demo documentation.
demo documentation.
.. note:: .. note::
The installation of Ruby and Node is outside the scope of this The installation of Node is outside the scope of this documentation. You
documentation. You will need both in order to make changes to this theme. will need Node version 10+ in order to make changes to this theme.
Set up your environment Set up your environment
----------------------- -----------------------
@ -27,13 +26,7 @@ Set up your environment
pip install -e '.[dev]' pip install -e '.[dev]'
#. Install SASS. #. Install Webpack_, node-sass_, and theme dependencies locally.
.. code:: console
gem install sass
#. Install Bower, Grunt, and theme dependencies locally.
.. code:: console .. code:: console
@ -42,31 +35,31 @@ Set up your environment
Making changes Making changes
-------------- --------------
Changes to the theme can be compiled and tested with the default Grunt task: Changes to the theme can be compiled and tested with Webpack_:
.. code:: console .. code:: console
grunt npm run dev
This default task will do the following: This script will do the following:
#. Install and update any Bower dependencies. #. Install and update any dependencies.
#. Build the static CSS from SASS source files. #. Build the static CSS from SASS source files.
#. Build the demo documentation. #. Build the demo documentation.
#. Watch for changes to the SASS files and documentation and rebuild everything #. Watch for changes to the SASS files and documentation and rebuild everything
on any detected changes. on any detected changes.
Alternatively, if you don't need to watch the files, Grunt can be called with Alternatively, if you don't need to watch the files, the release build script
the same task used for releases: can be used to test built assets:
.. code:: console .. code:: console
grunt build npm run build
.. _Bower: http://www.bower.io .. _Webpack: https://webpack.js.org/
.. _node-sass: https://github.com/sass/node-sass
.. _SASS: http://www.sass-lang.com .. _SASS: http://www.sass-lang.com
.. _Wyrm: http://www.github.com/snide/wyrm/ .. _Wyrm: http://www.github.com/snide/wyrm/
.. _Grunt: http://www.gruntjs.com
.. _Sphinx: http://www.sphinx-doc.org/en/stable/ .. _Sphinx: http://www.sphinx-doc.org/en/stable/
Translations Translations
@ -96,10 +89,12 @@ Releasing the theme
To release a new version of the theme, core team will take the following steps: To release a new version of the theme, core team will take the following steps:
#. Bump the version in ``sphinx_rtd_theme/__init__.py``, ``bower.json`` and ``package.json`` -- #. Bump the version in ``sphinx_rtd_theme/__init__.py``, ``setup.py`` and
we try to follow `semver <http://semver.org/>`_, so be careful with breaking changes. ``package.json``. We follow `semver <http://semver.org/>`_ and `PEP440`_
(with regards to alpha release and development versions). The version
increment should reflect these releases and any potentially breaking changes.
#. Update the changelog (``docs/changelog.rst``) with the version information. #. Update the changelog (``docs/changelog.rst``) with the version information.
#. Run ``grunt build`` to rebuild all the theme assets. #. Run ``npm run build`` to rebuild all the theme assets.
#. Run ``python setup.py update_translations`` to compile new translation files and update Transifex #. Run ``python setup.py update_translations`` to compile new translation files and update Transifex
#. Commit that change. #. Commit that change.
#. Tag the release in git: ``git tag $NEW_VERSION``. #. Tag the release in git: ``git tag $NEW_VERSION``.
@ -111,3 +106,5 @@ To release a new version of the theme, core team will take the following steps:
rm -rf dist/ rm -rf dist/
python setup.py sdist bdist_wheel python setup.py sdist bdist_wheel
twine upload --sign --identity security@readthedocs.org dist/* twine upload --sign --identity security@readthedocs.org dist/*
.. _PEP440: https://www.python.org/dev/peps/pep-0440/

View File

@ -3,21 +3,33 @@
"main": "js/theme.js", "main": "js/theme.js",
"version": "0.4.3", "version": "0.4.3",
"private": true, "private": true,
"scripts": {
"dev": "webpack-dev-server --open --config webpack.dev.js",
"build": "webpack --config webpack.prod.js"
},
"dependencies": {},
"devDependencies": { "devDependencies": {
"bower": "^1.8.4", "bourbon": "~4.3",
"browserify": "^13.0.0", "bourbon-neat": "~1.9",
"connect-livereload": "~0.6.0", "css-loader": "^3.1.0",
"grunt": "~1.0.1", "file-loader": "^3.0.1",
"grunt-banner": "^0.6.0", "font-awesome": "^4.7.0",
"grunt-browserify": "^5.0.0", "imports-loader": "^0.8.0",
"grunt-contrib-clean": "^1.0.0", "jquery": "^3.4.1",
"grunt-contrib-connect": "^1.0.2", "lato-font": "^3.0.0",
"grunt-contrib-copy": "~1.0.0", "matchdep": "~1.0.1",
"grunt-contrib-sass": "~1.0.0", "mini-css-extract-plugin": "^0.6.0",
"grunt-contrib-uglify": "~3.3.0", "node-sass": "^4.12.0",
"grunt-contrib-watch": "~1.0.0", "optimize-css-assets-webpack-plugin": "^5.0.3",
"grunt-exec": "~1.0.1", "roboto-fontface": "^0.10.0",
"grunt-open": "0.2.3", "sass-loader": "^7.1.0",
"matchdep": "~1.0.1" "style-loader": "^0.23.1",
"webpack": "^4.30.0",
"webpack-cli": "^3.3.1",
"webpack-dev-server": "^3.3.1",
"webpack-merge": "^4.2.1",
"webpack-shell-plugin": "^0.5.0",
"webpack-watch-files-plugin": "^1.0.3",
"wyrm": "^1.0.9"
} }
} }

View File

@ -1,47 +0,0 @@
@font-face
font-family: 'Lato'
src: url('../fonts/Lato/lato-regular.eot')
src: url('../fonts/Lato/lato-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/Lato/lato-regular.woff2') format('woff2'), url('../fonts/Lato/lato-regular.woff') format('woff'), url('../fonts/Lato/lato-regular.ttf') format('truetype')
font-weight: 400
font-style: normal
font-display: $font-display
@font-face
font-family: 'Lato'
src: url('../fonts/Lato/lato-bold.eot')
src: url('../fonts/Lato/lato-bold.eot?#iefix') format('embedded-opentype'), url('../fonts/Lato/lato-bold.woff2') format('woff2'), url('../fonts/Lato/lato-bold.woff') format('woff'), url('../fonts/Lato/lato-bold.ttf') format('truetype')
font-weight: 700
font-style: normal
font-display: $font-display
@font-face
font-family: 'Lato'
src: url('../fonts/Lato/lato-bolditalic.eot')
src: url('../fonts/Lato/lato-bolditalic.eot?#iefix') format('embedded-opentype'), url('../fonts/Lato/lato-bolditalic.woff2') format('woff2'), url('../fonts/Lato/lato-bolditalic.woff') format('woff'), url('../fonts/Lato/lato-bolditalic.ttf') format('truetype')
font-weight: 700
font-style: italic
font-display: $font-display
@font-face
font-family: 'Lato'
src: url('../fonts/Lato/lato-italic.eot')
src: url('../fonts/Lato/lato-italic.eot?#iefix') format('embedded-opentype'), url('../fonts/Lato/lato-italic.woff2') format('woff2'), url('../fonts/Lato/lato-italic.woff') format('woff'), url('../fonts/Lato/lato-italic.ttf') format('truetype')
font-weight: 400
font-style: italic
font-display: $font-display
@font-face
font-family: 'Roboto Slab'
font-style: normal
font-weight: 400
src: url('../fonts/RobotoSlab/roboto-slab.eot')
src: url('../fonts/RobotoSlab/roboto-slab-v7-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/RobotoSlab/roboto-slab-v7-regular.woff2') format('woff2'), url('../fonts/RobotoSlab/roboto-slab-v7-regular.woff') format('woff'), url('../fonts/RobotoSlab/roboto-slab-v7-regular.ttf') format('truetype')
font-display: $font-display
@font-face
font-family: 'Roboto Slab'
font-style: normal
font-weight: 700
src: url('../fonts/RobotoSlab/roboto-slab-v7-bold.eot')
src: url('../fonts/RobotoSlab/roboto-slab-v7-bold.eot?#iefix') format('embedded-opentype'), url('../fonts/RobotoSlab/roboto-slab-v7-bold.woff2') format('woff2'), url('../fonts/RobotoSlab/roboto-slab-v7-bold.woff') format('woff'), url('../fonts/RobotoSlab/roboto-slab-v7-bold.ttf') format('truetype')
font-display: $font-display

View File

@ -10,8 +10,6 @@ import distutils.cmd
from io import open from io import open
from setuptools import setup from setuptools import setup
from sphinx_rtd_theme import __version__
class UpdateTranslationsCommand(distutils.cmd.Command): class UpdateTranslationsCommand(distutils.cmd.Command):
@ -55,7 +53,7 @@ class TransifexCommand(distutils.cmd.Command):
setup( setup(
name='sphinx_rtd_theme', name='sphinx_rtd_theme',
version=__version__, version='0.4.3.dev0',
url='https://github.com/rtfd/sphinx_rtd_theme/', url='https://github.com/rtfd/sphinx_rtd_theme/',
license='MIT', license='MIT',
author='Dave Snider, Read the Docs, Inc. & contributors', author='Dave Snider, Read the Docs, Inc. & contributors',

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

3
src/index.js Normal file
View File

@ -0,0 +1,3 @@
import './sass/theme.sass';
import './sass/badge_only.sass';
import './theme.js';

View File

@ -1,6 +1,6 @@
// Slimmer version of FA for use on the badge_only.sass file. // Slimmer version of FA for use on the badge_only.sass file.
+font-face(FontAwesome, '#{$font-awesome-dir}fontawesome-webfont') +font-face(FontAwesome, '#{$fa-font-path}/fontawesome-webfont')
.fa:before .fa:before
display: inline-block display: inline-block

View File

@ -0,0 +1,46 @@
$lato-font-path: "~lato-font/fonts";
$roboto-font-path: "~roboto-fontface/fonts/roboto-slab";
// $font-full-path: '#{$roboto-font-path}/roboto-slab/Roboto-Slab';
@font-face
font-family: 'Lato'
src: url('#{$lato-font-path}/lato-normal/lato-normal.woff2') format('woff2'), url('#{$lato-font-path}/lato-normal/lato-normal.woff') format('woff')
font-weight: 400
font-style: normal
font-display: $font-display
@font-face
font-family: 'Lato'
src: url('#{$lato-font-path}/lato-bold/lato-bold.woff2') format('woff2'), url('#{$lato-font-path}/lato-bold/lato-bold.woff') format('woff')
font-weight: 700
font-style: normal
font-display: $font-display
@font-face
font-family: 'Lato'
src: url('#{$lato-font-path}/lato-bold-italic/lato-bold-italic.woff2') format('woff2'), url('#{$lato-font-path}/lato-bold-italic/lato-bold-italic.woff') format('woff')
font-weight: 700
font-style: italic
font-display: $font-display
@font-face
font-family: 'Lato'
src: url('#{$lato-font-path}/lato-normal-italic/lato-normal-italic.woff2') format('woff2'), url('#{$lato-font-path}/lato-normal-italic/lato-normal-italic.woff') format('woff')
font-weight: 400
font-style: italic
font-display: $font-display
@font-face
font-family: 'Roboto Slab'
font-style: normal
font-weight: 400
src: url('#{$roboto-font-path}/Roboto-Slab-Regular.woff2') format('woff2'), url('#{$roboto-font-path}/Roboto-Slab-Regular.woff') format('woff')
font-display: $font-display
@font-face
font-family: 'Roboto Slab'
font-style: normal
font-weight: 700
src: url('#{$roboto-font-path}/Roboto-Slab-Bold.woff2') format('woff2'), url('#{$roboto-font-path}/Roboto-Slab-Bold.woff') format('woff')
font-display: $font-display

View File

@ -2,7 +2,7 @@
// that are set in wyrm_core/wy_variables.sass. You'll find wyrm in bower_components if you're looking // that are set in wyrm_core/wy_variables.sass. You'll find wyrm in bower_components if you're looking
// for a reference. // for a reference.
$font-awesome-dir: "../fonts/" $fa-font-path: "~font-awesome/fonts"
$static-img: "../img/" $static-img: "../img/"
$nav-content-width: 800px $nav-content-width: 800px

View File

@ -8,8 +8,8 @@ $border-box-sizing: false !default
@import wyrm_core/wy_variables @import wyrm_core/wy_variables
@import theme_variables @import theme_variables
@import bourbon @import ~bourbon/app/assets/stylesheets/bourbon
@import neat @import ~bourbon-neat/app/assets/stylesheets/neat
@import wyrm_core/mixin @import wyrm_core/mixin
@import wyrm_core/grid_settings @import wyrm_core/grid_settings
@import _theme_badge_fa @import _theme_badge_fa

View File

@ -13,11 +13,11 @@
@import theme_variables @import theme_variables
// bourbon.io framework // bourbon.io framework
@import bourbon @import ~bourbon/app/assets/stylesheets/bourbon
// Bourbon.io/neat framework, with some default media queries // Bourbon.io/neat framework, with some default media queries
@import wyrm_core/grid_settings @import wyrm_core/grid_settings
@import neat @import ~bourbon-neat/app/assets/stylesheets/neat
// Some corrections for neat // Some corrections for neat
@import wyrm_core/neat_extra @import wyrm_core/neat_extra

56
webpack.common.js Normal file
View File

@ -0,0 +1,56 @@
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './src/index.js',
output: {
filename: 'js/theme.js',
path: path.resolve(__dirname, 'sphinx_rtd_theme/static')
},
module: {
rules: [
{
test: require.resolve('./src/theme.js'),
use: 'imports-loader?this=>window'
},
{
test: /\.sass$/,
use: [{
loader: MiniCssExtractPlugin.loader
},
{
loader: "css-loader"
},
{
loader: "sass-loader?indentedSyntax",
options: {
includePaths: [
'node_modules/bourbon/app/assets/stylesheets',
'node_modules/bourbon-neat/app/assets/stylesheets',
'node_modules/font-awesome/scss',
'node_modules/wyrm/sass'
]
}
}]
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]',
outputPath: 'fonts/',
publicPath: '../fonts/',
}
}]
}
]
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: 'css/theme.css'
})
],
};

34
webpack.dev.js Normal file
View File

@ -0,0 +1,34 @@
const path = require('path');
const merge = require('webpack-merge');
const exec = require('child_process').exec;
const WatchPlugin = require('webpack-watch-files-plugin').default;
const ShellPlugin = require('webpack-shell-plugin');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'development',
watch: true,
devServer: {
contentBase: path.join(__dirname, 'docs/build/html'),
watchContentBase: true,
compress: false,
port: 1919,
hot: false,
liveReload: true,
publicPath: '/_static/'
},
plugins: [
new WatchPlugin({
files: [
'./docs/**/*.rst',
'./docs/**/*.py',
]
}),
new ShellPlugin({
onBuildEnd: ['make -C docs clean html'],
// dev=false here to force every build to trigger make, the default is
// first build only.
dev: false,
}),
]
});

11
webpack.prod.js Normal file
View File

@ -0,0 +1,11 @@
const merge = require('webpack-merge');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'production',
optimization: {
minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin({})],
},
});