Skip to content

Commit

Permalink
Merge pull request #3352 from owenconti/bug/3329-duplicate-css
Browse files Browse the repository at this point in the history
Fixes #3329 - Fix duplicate CSS in production builds
  • Loading branch information
shockey authored Jul 18, 2017
2 parents 904d3ec + b1ab6b0 commit 7b5a327
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 240 deletions.
1 change: 0 additions & 1 deletion make-webpack-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ module.exports = function(rules, options) {
}

if( specialOptions.minimize ) {

plugins.push(
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "2.0.3",
"less": "2.7.2",
"less-loader": "4.0.4",
"license-checker": "^11.0.0",
"mocha": "^3.4.2",
"node-sass": "^4.5.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react"
import PropTypes from "prop-types"
import SplitPane from "react-split-pane"
import "./split-pane-mode.less"

const MODE_KEY = ["split-pane-mode"]
const MODE_LEFT = "left"
Expand Down

This file was deleted.

52 changes: 0 additions & 52 deletions src/plugins/topbar/topbar.less

This file was deleted.

2 changes: 0 additions & 2 deletions src/standalone/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import StandaloneLayout from "./layout"
import "../style/main.scss"

import TopbarPlugin from "plugins/topbar"
import ConfigsPlugin from "plugins/configs"

Expand Down
3 changes: 3 additions & 0 deletions src/style/_split-pane-mode.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Resizer.vertical.disabled {
display: none;
}
1 change: 1 addition & 0 deletions src/style/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
@import 'information';
@import 'authorize';
@import 'errors';
@import 'split-pane-mode';
}
56 changes: 12 additions & 44 deletions webpack-dist-bundle.config.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,32 @@
var path = require('path')
var rules = [
const path = require("path")
const styleRules = require("./webpack.dist-style.config.js")

let rules = [
{ test: /\.(worker\.js)(\?.*)?$/,
use: [
{
loader: 'worker-loader',
loader: "worker-loader",
options: {
inline: true,
name: '[name].js'
}
},
{ 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'
name: "[name].js"
}
}
]
},
{ test: /\.(less)(\?.*)?$/,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
},
'less-loader'
{ loader: "babel-loader" }
]
}
]

module.exports = require('./make-webpack-config.js')(rules, {
module.exports = require("./make-webpack-config.js")(rules, {
_special: {
separateStylesheets: false,
separateStylesheets: true,
minimize: true,
sourcemaps: true,
},

entry: {
'swagger-ui-bundle': [
'./src/polyfills',
'./src/core/index.js'
"swagger-ui-bundle": [
"./src/polyfills",
"./src/core/index.js"
]
},

Expand Down
55 changes: 11 additions & 44 deletions webpack-dist-standalone.config.js
Original file line number Diff line number Diff line change
@@ -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)(\?.*)?$/,
use: [
{
loader: 'worker-loader',
loader: "worker-loader",
options: {
inline: true,
name: '[name].js'
name: "[name].js"
}
},
{ 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'
{ loader: "babel-loader" }
]
}
]

module.exports = require('./make-webpack-config.js')(rules, {
module.exports = require("./make-webpack-config.js")(rules, {
_special: {
separateStylesheets: false,
separateStylesheets: true,
minimize: true,
sourcemaps: true,
},

entry: {
'swagger-ui-standalone-preset': [
'./src/polyfills',
'./src/standalone/index.js'
"swagger-ui-standalone-preset": [
"./src/polyfills",
"./src/standalone/index.js"
]
},

Expand Down
59 changes: 9 additions & 50 deletions webpack-dist.config.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,25 @@
var path = require('path')
var fs = require('fs')
const path = require("path")
const fs = require("fs")
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)(\?.*)?$/,
use: [
{
loader: 'worker-loader',
loader: "worker-loader",
options: {
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: {
separateStylesheets: true,
minimize: true,
Expand Down
Loading

0 comments on commit 7b5a327

Please sign in to comment.