mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2026-10-14 10:22:02 -05:00
A few of these squeezed by QA and testing:
* badge_only.css was copied to the static output path, it wasn't
actually building it seems. Added second entry for this to make it
easier.
* jQuery was not being treated as an external library and was vendored
into our JS bundle!
* Having the fonts in a relative path from CSS ('../fonts'), causes CORS
issues. Moved `/fonts` to `/sphinx_rtd_theme/static/css/fonts` essentially
* The dev server wasn't compiling assets consistently for me, tuned it hopefully
Requires #807
70 lines
1.6 KiB
JavaScript
70 lines
1.6 KiB
JavaScript
const path = require("path");
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
|
|
module.exports = {
|
|
entry: {
|
|
theme: ["./src/theme.js", "./src/sass/theme.sass"],
|
|
badge_only: "./src/sass/badge_only.sass"
|
|
},
|
|
output: {
|
|
filename: "js/[name].js?[hash]",
|
|
path: path.resolve(__dirname, "sphinx_rtd_theme/static")
|
|
},
|
|
externals: {
|
|
jquery: "jQuery"
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: require.resolve("./src/theme.js"),
|
|
use: "imports-loader?this=>window"
|
|
},
|
|
{
|
|
test: /\.sass$/,
|
|
use: [
|
|
{
|
|
loader: MiniCssExtractPlugin.loader,
|
|
options: {
|
|
hmr: false,
|
|
reloadAll: true
|
|
}
|
|
},
|
|
{
|
|
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: "css/fonts/",
|
|
publicPath: "fonts/"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new MiniCssExtractPlugin({
|
|
filename: "css/[name].css?[hash]",
|
|
chunkFilename: "css/[name].css?[hash]"
|
|
})
|
|
]
|
|
};
|