Bundles css
This commit is contained in:
parent
a64c523de8
commit
93f20da879
|
@ -11,10 +11,10 @@ branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- npm install
|
- npm ci
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- npm run deploy
|
- npm run build-prod
|
||||||
|
|
||||||
before_deploy: "echo 'node_modules' > .gitignore"
|
before_deploy: "echo 'node_modules' > .gitignore"
|
||||||
deploy:
|
deploy:
|
||||||
|
|
15
gulpfile.js
15
gulpfile.js
|
@ -1,15 +0,0 @@
|
||||||
const gulp = require("gulp");
|
|
||||||
const rename = require("gulp-rename");
|
|
||||||
const csso = require("gulp-csso");
|
|
||||||
|
|
||||||
gulp.task("minify-css", minifyCSS);
|
|
||||||
gulp.task("watch-css", function() {
|
|
||||||
return gulp.watch(["./src/styles/index.css"], minifyCSS);
|
|
||||||
});
|
|
||||||
|
|
||||||
function minifyCSS() {
|
|
||||||
return gulp.src("./src/styles/index.css")
|
|
||||||
.pipe(csso({restructure: false}))
|
|
||||||
.pipe(rename("style.css"))
|
|
||||||
.pipe(gulp.dest("./dist"));
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,10 +7,7 @@
|
||||||
"build": "webpack --progress --colors",
|
"build": "webpack --progress --colors",
|
||||||
"watch": "webpack --progress --colors --watch",
|
"watch": "webpack --progress --colors --watch",
|
||||||
"build-prod": "webpack --progress --colors --mode production -o dist/remote.js --devtool none",
|
"build-prod": "webpack --progress --colors --mode production -o dist/remote.js --devtool none",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
"minify-css": "gulp minify-css",
|
|
||||||
"watch-css": "gulp watch-css",
|
|
||||||
"deploy": "npm run build-prod && npm run minify-css"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -29,10 +26,8 @@
|
||||||
"@babel/register": "^7.10.5",
|
"@babel/register": "^7.10.5",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.1.0",
|
||||||
"circular-dependency-plugin": "^5.2.0",
|
"circular-dependency-plugin": "^5.2.0",
|
||||||
|
"css-loader": "^5.0.1",
|
||||||
"eslint-plugin-react": "^7.21.3",
|
"eslint-plugin-react": "^7.21.3",
|
||||||
"gulp": "^4.0.2",
|
|
||||||
"gulp-csso": "^4.0.1",
|
|
||||||
"gulp-rename": "^2.0.0",
|
|
||||||
"webpack": "^4.43.0",
|
"webpack": "^4.43.0",
|
||||||
"webpack-cli": "^3.3.12"
|
"webpack-cli": "^3.3.12"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
import Styles from "./styles/index.css";
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
const stylesheet = document.createElement("style");
|
||||||
|
stylesheet.id = "bd-stylesheet";
|
||||||
|
stylesheet.textContent = Styles.toString();
|
||||||
|
document.head.appendChild(stylesheet);
|
||||||
|
};
|
|
@ -1,6 +1,9 @@
|
||||||
import localStorageFix from "./localStorageFix";
|
import localStorageFix from "./localStorageFix";
|
||||||
import loadingIcon from "./loadingIcon";
|
import loadingIcon from "./loadingIcon";
|
||||||
|
import addStyles from "./addstyles";
|
||||||
|
|
||||||
localStorageFix();
|
localStorageFix();
|
||||||
|
addStyles();
|
||||||
loadingIcon();
|
loadingIcon();
|
||||||
|
|
||||||
const deprecateGlobal = (key, value) => {
|
const deprecateGlobal = (key, value) => {
|
||||||
|
|
|
@ -14,21 +14,6 @@ import DOM from "./domtools";
|
||||||
import BDLogo from "../ui/bdLogo";
|
import BDLogo from "../ui/bdLogo";
|
||||||
import TooltipWrap from "../ui/tooltipWrap";
|
import TooltipWrap from "../ui/tooltipWrap";
|
||||||
|
|
||||||
const dependencies = [
|
|
||||||
{
|
|
||||||
name: "jquery",
|
|
||||||
type: "script",
|
|
||||||
url: "//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js",
|
|
||||||
backup: "//cdn.jsdelivr.net/gh/jquery/jquery@2.0.0/jquery.min.js"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "bd-stylesheet",
|
|
||||||
type: "style",
|
|
||||||
url: `//cdn.staticaly.com/gh/rauenzi/BetterDiscordApp/{{hash}}/dist/style.css`,
|
|
||||||
backup: "//rauenzi.github.io/BetterDiscordApp/dist/style.css"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const {ipcRenderer} = require("electron");
|
const {ipcRenderer} = require("electron");
|
||||||
function Core() {
|
function Core() {
|
||||||
ipcRenderer.invoke("bd-config").then(injectorConfig => {
|
ipcRenderer.invoke("bd-config").then(injectorConfig => {
|
||||||
|
@ -152,20 +137,19 @@ Core.prototype.checkForGuilds = function() {
|
||||||
|
|
||||||
Core.prototype.injectExternals = async function() {
|
Core.prototype.injectExternals = async function() {
|
||||||
await DOM.addScript("ace-script", "https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js");
|
await DOM.addScript("ace-script", "https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js");
|
||||||
|
|
||||||
if (window.require.original) window.require = window.require.original;
|
if (window.require.original) window.require = window.require.original;
|
||||||
if (window.$ && window.jQuery) return; // Dependencies already loaded
|
if (window.$ && window.jQuery) return; // Dependencies already loaded
|
||||||
const jqueryUrl = Utils.formatString(dependencies[0].url, {repo: bdConfig.repo, hash: bdConfig.hash, minified: bdConfig.minified ? ".min" : "", localServer: bdConfig.localServer});
|
|
||||||
try {await DOM.addScript("jquery", jqueryUrl);}
|
try {await DOM.addScript("jquery", "https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js");}
|
||||||
catch (_) {
|
catch (_) {
|
||||||
try {
|
try {
|
||||||
const backup = Utils.formatString(dependencies[0].backup, {minified: bdConfig.minified ? ".min" : ""});
|
await DOM.addScript("jquery", "https://cdn.jsdelivr.net/gh/jquery/jquery@2.0.0/jquery.min.js");
|
||||||
await DOM.addScript("jquery", backup);
|
|
||||||
}
|
}
|
||||||
catch (__) {
|
catch (__) {
|
||||||
Utils.alert("jQuery Not Loaded", "Unable to load jQuery, some plugins may fail to work. Proceed at your own risk.");
|
Utils.alert("jQuery Not Loaded", "Unable to load jQuery, some plugins may fail to work. Proceed at your own risk.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.head.append(DOM.createElement(`<link rel="stylesheet" href=${Utils.formatString(dependencies[1].url, {repo: bdConfig.repo, hash: bdConfig.hash, minified: bdConfig.minified ? ".min" : "", localServer: bdConfig.localServer})}>`));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Core.prototype.initSettings = function () {
|
Core.prototype.initSettings = function () {
|
||||||
|
|
|
@ -43,6 +43,10 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}], "@babel/react"]
|
}], "@babel/react"]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.css$/i,
|
||||||
|
use: ["css-loader"],
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue