Merge pull request #3352 from owenconti/bug/3329-duplicate-css
Fixes #3329 - Fix duplicate CSS in production builds
This commit is contained in:
@@ -61,7 +61,6 @@ module.exports = function(rules, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( specialOptions.minimize ) {
|
if( specialOptions.minimize ) {
|
||||||
|
|
||||||
plugins.push(
|
plugins.push(
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
|
|||||||
@@ -109,7 +109,6 @@
|
|||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
"karma-webpack": "2.0.3",
|
"karma-webpack": "2.0.3",
|
||||||
"less": "2.7.2",
|
"less": "2.7.2",
|
||||||
"less-loader": "4.0.4",
|
|
||||||
"license-checker": "^11.0.0",
|
"license-checker": "^11.0.0",
|
||||||
"mocha": "^3.4.2",
|
"mocha": "^3.4.2",
|
||||||
"node-sass": "^4.5.0",
|
"node-sass": "^4.5.0",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
import SplitPane from "react-split-pane"
|
import SplitPane from "react-split-pane"
|
||||||
import "./split-pane-mode.less"
|
|
||||||
|
|
||||||
const MODE_KEY = ["split-pane-mode"]
|
const MODE_KEY = ["split-pane-mode"]
|
||||||
const MODE_LEFT = "left"
|
const MODE_LEFT = "left"
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
.swagger-ui {
|
|
||||||
.Resizer.vertical.disabled {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
.swagger-ui {
|
|
||||||
.topbar {
|
|
||||||
background-color: #89bf04;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topbar-wrapper {
|
|
||||||
padding: 0.7em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topbar-logo__img {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topbar-logo__title {
|
|
||||||
display: inline-block;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 1.5em;
|
|
||||||
font-weight: bold;
|
|
||||||
margin: 0.15em 0 0 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.download-url-wrapper {
|
|
||||||
text-align: right;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topbar .download-url__text {
|
|
||||||
width: 28em;
|
|
||||||
height: 2em;
|
|
||||||
margin-right: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.download-url__btn {
|
|
||||||
background-color: #547f00;
|
|
||||||
border-color: #547f00;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 0.2em 0.3em;
|
|
||||||
color: white;
|
|
||||||
border-radius: 0.1em;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
&:extend(.download-url__btn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.center-700 {
|
|
||||||
display: block;
|
|
||||||
margin: 0 auto;
|
|
||||||
width: 45em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
import StandaloneLayout from "./layout"
|
import StandaloneLayout from "./layout"
|
||||||
import "../style/main.scss"
|
|
||||||
|
|
||||||
import TopbarPlugin from "plugins/topbar"
|
import TopbarPlugin from "plugins/topbar"
|
||||||
import ConfigsPlugin from "plugins/configs"
|
import ConfigsPlugin from "plugins/configs"
|
||||||
|
|
||||||
|
|||||||
3
src/style/_split-pane-mode.scss
Normal file
3
src/style/_split-pane-mode.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.Resizer.vertical.disabled {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@@ -14,4 +14,5 @@
|
|||||||
@import 'information';
|
@import 'information';
|
||||||
@import 'authorize';
|
@import 'authorize';
|
||||||
@import 'errors';
|
@import 'errors';
|
||||||
|
@import 'split-pane-mode';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,64 +1,32 @@
|
|||||||
var path = require('path')
|
const path = require("path")
|
||||||
var rules = [
|
const styleRules = require("./webpack.dist-style.config.js")
|
||||||
|
|
||||||
|
let rules = [
|
||||||
{ test: /\.(worker\.js)(\?.*)?$/,
|
{ test: /\.(worker\.js)(\?.*)?$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'worker-loader',
|
loader: "worker-loader",
|
||||||
options: {
|
options: {
|
||||||
inline: true,
|
inline: true,
|
||||||
name: '[name].js'
|
name: "[name].js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ loader: 'babel-loader' }
|
{ loader: "babel-loader" }
|
||||||
]
|
|
||||||
},
|
|
||||||
{ test: /\.(css)(\?.*)?$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
'css-loader',
|
|
||||||
'postcss-loader'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{ test: /\.(scss)(\?.*)?$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
'css-loader',
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
options: { sourceMap: true }
|
|
||||||
},
|
|
||||||
{ loader: 'sass-loader',
|
|
||||||
options: {
|
|
||||||
outputStyle: 'expanded',
|
|
||||||
sourceMap: true,
|
|
||||||
sourceMapContents: 'true'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{ test: /\.(less)(\?.*)?$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
'css-loader',
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
},
|
|
||||||
'less-loader'
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
module.exports = require('./make-webpack-config.js')(rules, {
|
module.exports = require("./make-webpack-config.js")(rules, {
|
||||||
_special: {
|
_special: {
|
||||||
separateStylesheets: false,
|
separateStylesheets: true,
|
||||||
minimize: true,
|
minimize: true,
|
||||||
sourcemaps: true,
|
sourcemaps: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
'swagger-ui-bundle': [
|
"swagger-ui-bundle": [
|
||||||
'./src/polyfills',
|
"./src/polyfills",
|
||||||
'./src/core/index.js'
|
"./src/core/index.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,65 +1,32 @@
|
|||||||
var path = require('path')
|
const path = require("path")
|
||||||
|
const styleRules = require("./webpack.dist-style.config.js")
|
||||||
|
|
||||||
var rules = [
|
let rules = [
|
||||||
{ test: /\.(worker\.js)(\?.*)?$/,
|
{ test: /\.(worker\.js)(\?.*)?$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'worker-loader',
|
loader: "worker-loader",
|
||||||
options: {
|
options: {
|
||||||
inline: true,
|
inline: true,
|
||||||
name: '[name].js'
|
name: "[name].js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ loader: 'babel-loader' }
|
{ loader: "babel-loader" }
|
||||||
]
|
|
||||||
},
|
|
||||||
{ test: /\.(css)(\?.*)?$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
'css-loader',
|
|
||||||
'postcss-loader'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{ test: /\.(scss)(\?.*)?$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
'css-loader',
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
options: { sourceMap: true }
|
|
||||||
},
|
|
||||||
{ loader: 'sass-loader',
|
|
||||||
options: {
|
|
||||||
outputStyle: 'expanded',
|
|
||||||
sourceMap: true,
|
|
||||||
sourceMapContents: 'true'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{ test: /\.(less)(\?.*)?$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
'css-loader',
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
},
|
|
||||||
'less-loader'
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
module.exports = require('./make-webpack-config.js')(rules, {
|
module.exports = require("./make-webpack-config.js")(rules, {
|
||||||
_special: {
|
_special: {
|
||||||
separateStylesheets: false,
|
separateStylesheets: true,
|
||||||
minimize: true,
|
minimize: true,
|
||||||
sourcemaps: true,
|
sourcemaps: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
'swagger-ui-standalone-preset': [
|
"swagger-ui-standalone-preset": [
|
||||||
'./src/polyfills',
|
"./src/polyfills",
|
||||||
'./src/standalone/index.js'
|
"./src/standalone/index.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,66 +1,25 @@
|
|||||||
var path = require('path')
|
const path = require("path")
|
||||||
var fs = require('fs')
|
const fs = require("fs")
|
||||||
const nodeModules = fs.readdirSync("node_modules").filter(function(x) { return x !== ".bin" })
|
const nodeModules = fs.readdirSync("node_modules").filter(function(x) { return x !== ".bin" })
|
||||||
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
const styleRules = require("./webpack.dist-style.config.js")
|
||||||
|
|
||||||
var rules = [
|
let rules = [
|
||||||
{ test: /\.(worker\.js)(\?.*)?$/,
|
{ test: /\.(worker\.js)(\?.*)?$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'worker-loader',
|
loader: "worker-loader",
|
||||||
options: {
|
options: {
|
||||||
inline: true,
|
inline: true,
|
||||||
name: '[name].js'
|
name: "[name].js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ loader: 'babel-loader' }
|
{ loader: "babel-loader" }
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{ test: /\.(css)(\?.*)?$/,
|
|
||||||
use: ExtractTextPlugin.extract({
|
|
||||||
fallback: 'style-loader',
|
|
||||||
use: [
|
|
||||||
'css-loader',
|
|
||||||
'postcss-loader'
|
|
||||||
]
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ test: /\.(scss)(\?.*)?$/,
|
|
||||||
use: ExtractTextPlugin.extract({
|
|
||||||
fallback: 'style-loader',
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: { minimize: true }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
options: { sourceMap: true }
|
|
||||||
},
|
|
||||||
{ loader: 'sass-loader',
|
|
||||||
options: {
|
|
||||||
outputStyle: 'expanded',
|
|
||||||
sourceMap: true,
|
|
||||||
sourceMapContents: 'true'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ test: /\.(less)(\?.*)?$/,
|
|
||||||
use: ExtractTextPlugin.extract({
|
|
||||||
fallback: 'style-loader',
|
|
||||||
use: ['css-loader',
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
},
|
|
||||||
'less-loader'
|
|
||||||
]
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
rules = rules.concat(styleRules)
|
||||||
|
|
||||||
module.exports = require('./make-webpack-config.js')(rules, {
|
module.exports = require("./make-webpack-config.js")(rules, {
|
||||||
_special: {
|
_special: {
|
||||||
separateStylesheets: true,
|
separateStylesheets: true,
|
||||||
minimize: true,
|
minimize: true,
|
||||||
|
|||||||
@@ -1,56 +1,46 @@
|
|||||||
var path = require('path')
|
const path = require("path")
|
||||||
|
|
||||||
var rules = [
|
const rules = [
|
||||||
{ test: /\.(worker\.js)(\?.*)?$/,
|
{ test: /\.(worker\.js)(\?.*)?$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'worker-loader',
|
loader: "worker-loader",
|
||||||
options: {
|
options: {
|
||||||
inline: true
|
inline: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ loader: 'babel-loader' }
|
{ loader: "babel-loader" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ test: /\.(jsx)(\?.*)?$/,
|
{ test: /\.(jsx)(\?.*)?$/,
|
||||||
use: [
|
use: [
|
||||||
{ loader: 'react-hot-loader' },
|
{ loader: "react-hot-loader" },
|
||||||
{ loader: 'babel-loader' }
|
{ loader: "babel-loader" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ test: /\.(css)(\?.*)?$/,
|
{ test: /\.(css)(\?.*)?$/,
|
||||||
use: [
|
use: [
|
||||||
'style-loader',
|
"style-loader",
|
||||||
'css-loader',
|
"css-loader",
|
||||||
'postcss-loader'
|
"postcss-loader"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ test: /\.(scss)(\?.*)?$/,
|
{ test: /\.(scss)(\?.*)?$/,
|
||||||
use: [
|
use: [
|
||||||
'style-loader',
|
"style-loader",
|
||||||
'css-loader',
|
"css-loader",
|
||||||
{
|
{
|
||||||
loader: 'postcss-loader',
|
loader: "postcss-loader",
|
||||||
options: { sourceMap: true }
|
options: { sourceMap: true }
|
||||||
},
|
},
|
||||||
{ loader: 'sass-loader',
|
{ loader: "sass-loader",
|
||||||
options: {
|
options: {
|
||||||
outputStyle: 'expanded',
|
outputStyle: "expanded",
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
sourceMapContents: 'true'
|
sourceMapContents: "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{ test: /\.(less)(\?.*)?$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
'css-loader',
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
},
|
|
||||||
'less-loader'
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -60,25 +50,26 @@ module.exports = require("./make-webpack-config")(rules, {
|
|||||||
},
|
},
|
||||||
devtool: "eval",
|
devtool: "eval",
|
||||||
entry: {
|
entry: {
|
||||||
'swagger-ui-bundle': [
|
"swagger-ui-bundle": [
|
||||||
'./src/polyfills',
|
"./src/polyfills",
|
||||||
'./src/core/index.js'
|
"./src/core/index.js"
|
||||||
],
|
],
|
||||||
'swagger-ui-standalone-preset': [
|
"swagger-ui-standalone-preset": [
|
||||||
'./src/polyfills',
|
"./src/style/main.scss",
|
||||||
'./src/standalone/index.js',
|
"./src/polyfills",
|
||||||
|
"./src/standalone/index.js",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
pathinfo: true,
|
pathinfo: true,
|
||||||
filename: '[name].js',
|
filename: "[name].js",
|
||||||
library: "[name]",
|
library: "[name]",
|
||||||
libraryTarget: "umd",
|
libraryTarget: "umd",
|
||||||
chunkFilename: "[id].js"
|
chunkFilename: "[id].js"
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
port: 3200,
|
port: 3200,
|
||||||
contentBase: path.join(__dirname, 'dev-helpers'),
|
contentBase: path.join(__dirname, "dev-helpers"),
|
||||||
publicPath: "/",
|
publicPath: "/",
|
||||||
noInfo: true,
|
noInfo: true,
|
||||||
hot: true,
|
hot: true,
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
var config = require("./webpack-dist.config.js")
|
const config = require("./webpack-dist.config.js")
|
||||||
|
|
||||||
module.exports = config
|
module.exports = config
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
const webpack = require('webpack')
|
const path = require("path")
|
||||||
const path = require('path')
|
const deepMerge = require("deepmerge")
|
||||||
const deepMerge = require('deepmerge')
|
const webpackConfig = require("./webpack-dist-bundle.config.js")
|
||||||
const webpackConfig = require('./webpack-dist-bundle.config.js')
|
const DEPS_CHECK_DIR = require("./package.json").config.deps_check_dir
|
||||||
const DEPS_CHECK_DIR = require('./package.json').config.deps_check_dir
|
|
||||||
|
|
||||||
module.exports = deepMerge(
|
module.exports = deepMerge(
|
||||||
webpackConfig, {
|
webpackConfig, {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
module.exports = require("./make-webpack-config")({
|
module.exports = require("./make-webpack-config")({
|
||||||
|
|
||||||
});
|
})
|
||||||
34
webpack.dist-style.config.js
Normal file
34
webpack.dist-style.config.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
const ExtractTextPlugin = require("extract-text-webpack-plugin")
|
||||||
|
|
||||||
|
module.exports = [{
|
||||||
|
test: /\.(css)(\?.*)?$/,
|
||||||
|
use: ExtractTextPlugin.extract({
|
||||||
|
fallback: "style-loader",
|
||||||
|
use: [
|
||||||
|
"css-loader",
|
||||||
|
"postcss-loader"
|
||||||
|
]
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{ test: /\.(scss)(\?.*)?$/,
|
||||||
|
use: ExtractTextPlugin.extract({
|
||||||
|
fallback: "style-loader",
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: "css-loader",
|
||||||
|
options: { minimize: true }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: "postcss-loader",
|
||||||
|
options: { sourceMap: true }
|
||||||
|
},
|
||||||
|
{ loader: "sass-loader",
|
||||||
|
options: {
|
||||||
|
outputStyle: "expanded",
|
||||||
|
sourceMap: true,
|
||||||
|
sourceMapContents: "true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}]
|
||||||
Reference in New Issue
Block a user