sphinx_rtd_theme/webpack.common.js

70 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
2019-07-02 05:17:20 -05:00
module.exports = {
entry: {
theme: ["./src/theme.js", "./src/sass/theme.sass"],
badge_only: "./src/sass/badge_only.sass"
},
2019-07-02 05:17:20 -05:00
output: {
filename: "js/[name].js?[hash]",
path: path.resolve(__dirname, "sphinx_rtd_theme/static")
2019-07-02 05:17:20 -05:00
},
externals: {
jquery: "jQuery"
},
2019-07-02 05:17:20 -05:00
module: {
rules: [
{
test: require.resolve("./src/theme.js"),
use: "imports-loader?this=>window"
2019-07-02 05:17:20 -05:00
},
{
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"
]
}
2019-07-02 05:17:20 -05:00
}
]
2019-07-02 05:17:20 -05:00
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "[name].[ext]?[hash]",
outputPath: "css/fonts/",
publicPath: "fonts/"
}
2019-07-02 05:17:20 -05:00
}
]
2019-07-02 05:17:20 -05:00
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "css/[name].css?[hash]",
chunkFilename: "css/[name].css?[hash]"
}),
]
};