prod working with mini css webpack plugin

master
d98762625 2019-02-11 15:40:18 +00:00
parent d22eac9f35
commit a7a2fe243a
2 changed files with 11 additions and 23 deletions

View File

@ -300,6 +300,9 @@ module.exports = function (grunt) {
"./config/modules/OpModules": "./config/modules/Default" "./config/modules/OpModules": "./config/modules/Default"
} }
}, },
output: {
globalObject: "this",
},
plugins: [ plugins: [
new webpack.DefinePlugin(BUILD_CONSTANTS), new webpack.DefinePlugin(BUILD_CONSTANTS),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({

View File

@ -563,35 +563,20 @@ class RecipeWaiter {
this.ingredientChildRuleID = null; this.ingredientChildRuleID = null;
// Find relevant rules in the stylesheet // Find relevant rules in the stylesheet
// try { for (const i in document.styleSheets[0].cssRules) {
if (document.styleSheets[0].hasOwnProperty("cssRules")) { if (document.styleSheets[0].cssRules[i].selectorText === ".ingredients") {
for (const i in document.styleSheets[0].cssRules) { this.ingredientRuleID = i;
if (document.styleSheets[0].cssRules[i].selectorText === ".ingredients") { }
this.ingredientRuleID = i; if (document.styleSheets[0].cssRules[i].selectorText === ".ingredients > div") {
} this.ingredientChildRuleID = i;
if (document.styleSheets[0].cssRules[i].selectorText === ".ingredients > div") {
this.ingredientChildRuleID = i;
}
} }
} }
// } catch (e) {
// console.log(e.constructor);
// console.warn("Can't read the css rules of: " + document.styleSheets[0], e);
// }
} }
if (!this.ingredientRuleID || !this.ingredientChildRuleID) return; if (!this.ingredientRuleID || !this.ingredientChildRuleID) return;
let ingredientRule, ingredientChildRule;
// Chrome 64+ const ingredientRule = document.styleSheets[0].cssRules[this.ingredientRuleID];
// try { const ingredientChildRule = document.styleSheets[0].cssRules[this.ingredientChildRuleID];
if (document.styleSheets[0].hasOwnProperty("cssRules")) {
ingredientRule = document.styleSheets[0].cssRules[this.ingredientRuleID];
ingredientChildRule = document.styleSheets[0].cssRules[this.ingredientChildRuleID];
}
// } catch (e) {
// console.warn("Can't read the css rules of: " + document.styleSheets[0], e);
// }
if (recList.clientWidth < 450) { if (recList.clientWidth < 450) {
ingredientRule.style.gridTemplateColumns = "auto auto"; ingredientRule.style.gridTemplateColumns = "auto auto";