Skip to content

Commit feb0beb

Browse files
authored
Merge pull request #807 from readthedocs/agj/format-webpack-js
Run webpack js through Prettier JS formatter
2 parents 5ba05cd + b3143a5 commit feb0beb

File tree

3 files changed

+56
-55
lines changed

3 files changed

+56
-55
lines changed

webpack.common.js

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,60 @@
1-
const path = require('path');
2-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1+
const path = require("path");
2+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
33

44
module.exports = {
5-
entry: './src/index.js',
5+
entry: "./src/index.js",
66
output: {
7-
filename: 'js/theme.js',
8-
path: path.resolve(__dirname, 'sphinx_rtd_theme/static')
7+
filename: "js/theme.js",
8+
path: path.resolve(__dirname, "sphinx_rtd_theme/static")
99
},
1010
module: {
1111
rules: [
1212
{
13-
test: require.resolve('./src/theme.js'),
14-
use: 'imports-loader?this=>window'
13+
test: require.resolve("./src/theme.js"),
14+
use: "imports-loader?this=>window"
1515
},
1616
{
1717
test: /\.sass$/,
18-
use: [{
19-
loader: MiniCssExtractPlugin.loader
20-
},
21-
{
22-
loader: "css-loader"
23-
},
24-
{
25-
loader: "sass-loader?indentedSyntax",
26-
options: {
27-
includePaths: [
28-
'node_modules/bourbon/app/assets/stylesheets',
29-
'node_modules/bourbon-neat/app/assets/stylesheets',
30-
'node_modules/font-awesome/scss',
31-
'node_modules/wyrm/sass'
32-
]
18+
use: [
19+
{
20+
loader: MiniCssExtractPlugin.loader
21+
},
22+
{
23+
loader: "css-loader"
24+
},
25+
{
26+
loader: "sass-loader?indentedSyntax",
27+
options: {
28+
includePaths: [
29+
"node_modules/bourbon/app/assets/stylesheets",
30+
"node_modules/bourbon-neat/app/assets/stylesheets",
31+
"node_modules/font-awesome/scss",
32+
"node_modules/wyrm/sass"
33+
]
34+
}
3335
}
34-
}]
36+
]
3537
},
3638
{
3739
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
38-
use: [{
39-
loader: 'file-loader',
40-
options: {
41-
name: '[name].[ext]?[hash]',
42-
outputPath: 'fonts/',
43-
publicPath: '../fonts/',
40+
use: [
41+
{
42+
loader: "file-loader",
43+
options: {
44+
name: "[name].[ext]?[hash]",
45+
outputPath: "fonts/",
46+
publicPath: "../fonts/"
47+
}
4448
}
45-
}]
49+
]
4650
}
4751
]
4852
},
4953
plugins: [
5054
new MiniCssExtractPlugin({
5155
// Options similar to the same options in webpackOptions.output
5256
// both options are optional
53-
filename: 'css/theme.css'
57+
filename: "css/theme.css"
5458
})
55-
],
59+
]
5660
};

webpack.dev.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
1-
const path = require('path');
2-
const merge = require('webpack-merge');
3-
const exec = require('child_process').exec;
4-
const WatchPlugin = require('webpack-watch-files-plugin').default;
5-
const ShellPlugin = require('webpack-shell-plugin');
6-
const common = require('./webpack.common.js');
1+
const path = require("path");
2+
const merge = require("webpack-merge");
3+
const exec = require("child_process").exec;
4+
const WatchPlugin = require("webpack-watch-files-plugin").default;
5+
const ShellPlugin = require("webpack-shell-plugin");
6+
const common = require("./webpack.common.js");
77

88
module.exports = merge(common, {
9-
mode: 'development',
9+
mode: "development",
1010
watch: true,
1111
devServer: {
12-
contentBase: path.join(__dirname, 'docs/build/html'),
12+
contentBase: path.join(__dirname, "docs/build/html"),
1313
watchContentBase: true,
1414
compress: false,
1515
port: 1919,
1616
hot: false,
1717
liveReload: true,
18-
publicPath: '/_static/'
18+
publicPath: "/_static/"
1919
},
2020
plugins: [
2121
new WatchPlugin({
22-
files: [
23-
'./docs/**/*.rst',
24-
'./docs/**/*.py',
25-
]
22+
files: ["./docs/**/*.rst", "./docs/**/*.py"]
2623
}),
2724
new ShellPlugin({
28-
onBuildEnd: ['make -C docs clean html'],
25+
onBuildEnd: ["make -C docs clean html"],
2926
// dev=false here to force every build to trigger make, the default is
3027
// first build only.
31-
dev: false,
32-
}),
28+
dev: false
29+
})
3330
]
3431
});

webpack.prod.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const merge = require('webpack-merge');
2-
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
3-
const TerserPlugin = require('terser-webpack-plugin');
4-
const common = require('./webpack.common.js');
1+
const merge = require("webpack-merge");
2+
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
3+
const TerserPlugin = require("terser-webpack-plugin");
4+
const common = require("./webpack.common.js");
55

66
module.exports = merge(common, {
7-
mode: 'production',
7+
mode: "production",
88
optimization: {
9-
minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin({})],
10-
},
9+
minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin({})]
10+
}
1111
});

0 commit comments

Comments
 (0)