Skip to content

Commit de31828

Browse files
author
Bot
committed
final version of webpack config with compression
1 parent de5f3d5 commit de31828

8 files changed

+160
-12794
lines changed

.browserslistrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
> 1%
2-
last 2 versions
1+
last 2 years

cors.json

-6
This file was deleted.

package-lock copy.json

-12,640
This file was deleted.

public/cm/theme/material-darker.css

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/*
2+
Name: material
3+
Author: Mattia Astorino (http://github.com/equinusocio)
4+
Website: https://material-theme.site/
5+
*/
6+
7+
.cm-s-material-darker.CodeMirror {
8+
background-color: #212121;
9+
color: #EEFFFF;
10+
}
11+
12+
.cm-s-material-darker .CodeMirror-gutters {
13+
background: #212121;
14+
color: #545454;
15+
border: none;
16+
}
17+
18+
.cm-s-material-darker .CodeMirror-guttermarker,
19+
.cm-s-material-darker .CodeMirror-guttermarker-subtle,
20+
.cm-s-material-darker .CodeMirror-linenumber {
21+
color: #545454;
22+
}
23+
24+
.cm-s-material-darker .CodeMirror-cursor {
25+
border-left: 1px solid #FFCC00;
26+
}
27+
28+
.cm-s-material-darker div.CodeMirror-selected {
29+
background: rgba(97, 97, 97, 0.2);
30+
}
31+
32+
.cm-s-material-darker.CodeMirror-focused div.CodeMirror-selected {
33+
background: rgba(97, 97, 97, 0.2);
34+
}
35+
36+
.cm-s-material-darker .CodeMirror-line::selection,
37+
.cm-s-material-darker .CodeMirror-line>span::selection,
38+
.cm-s-material-darker .CodeMirror-line>span>span::selection {
39+
background: rgba(128, 203, 196, 0.2);
40+
}
41+
42+
.cm-s-material-darker .CodeMirror-line::-moz-selection,
43+
.cm-s-material-darker .CodeMirror-line>span::-moz-selection,
44+
.cm-s-material-darker .CodeMirror-line>span>span::-moz-selection {
45+
background: rgba(128, 203, 196, 0.2);
46+
}
47+
48+
.cm-s-material-darker .CodeMirror-activeline-background {
49+
background: rgba(0, 0, 0, 0.5);
50+
}
51+
52+
.cm-s-material-darker .cm-keyword {
53+
color: #C792EA;
54+
}
55+
56+
.cm-s-material-darker .cm-operator {
57+
color: #89DDFF;
58+
}
59+
60+
.cm-s-material-darker .cm-variable-2 {
61+
color: #EEFFFF;
62+
}
63+
64+
.cm-s-material-darker .cm-variable-3,
65+
.cm-s-material-darker .cm-type {
66+
color: #f07178;
67+
}
68+
69+
.cm-s-material-darker .cm-builtin {
70+
color: #FFCB6B;
71+
}
72+
73+
.cm-s-material-darker .cm-atom {
74+
color: #F78C6C;
75+
}
76+
77+
.cm-s-material-darker .cm-number {
78+
color: #FF5370;
79+
}
80+
81+
.cm-s-material-darker .cm-def {
82+
color: #82AAFF;
83+
}
84+
85+
.cm-s-material-darker .cm-string {
86+
color: #C3E88D;
87+
}
88+
89+
.cm-s-material-darker .cm-string-2 {
90+
color: #f07178;
91+
}
92+
93+
.cm-s-material-darker .cm-comment {
94+
color: #545454;
95+
}
96+
97+
.cm-s-material-darker .cm-variable {
98+
color: #f07178;
99+
}
100+
101+
.cm-s-material-darker .cm-tag {
102+
color: #FF5370;
103+
}
104+
105+
.cm-s-material-darker .cm-meta {
106+
color: #FFCB6B;
107+
}
108+
109+
.cm-s-material-darker .cm-attribute {
110+
color: #C792EA;
111+
}
112+
113+
.cm-s-material-darker .cm-property {
114+
color: #C792EA;
115+
}
116+
117+
.cm-s-material-darker .cm-qualifier {
118+
color: #DECB6B;
119+
}
120+
121+
.cm-s-material-darker .cm-variable-3,
122+
.cm-s-material-darker .cm-type {
123+
color: #DECB6B;
124+
}
125+
126+
127+
.cm-s-material-darker .cm-error {
128+
color: rgba(255, 255, 255, 1.0);
129+
background-color: #FF5370;
130+
}
131+
132+
.cm-s-material-darker .CodeMirror-matchingbracket {
133+
text-decoration: underline;
134+
color: white !important;
135+
}
-1.1 KB
Binary file not shown.

src/cmLoader copy.js

-127
This file was deleted.

src/cmLoader.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import codemirror from 'vue-codemirror/src/codemirror.vue';
66
import 'codemirror/addon/mode/simple';
77
import 'codemirror/addon/mode/overlay';
88
import 'codemirror/lib/codemirror.css';
9-
import '../public/cm/theme/material-darker.css.gz';
9+
import '../public/cm/theme/material-darker.css';
1010
import 'codemirror/addon/selection/active-line';
1111
import 'cm-show-invisibles/lib/show-invisibles';
1212

13-
const assetsPath = process.env.VUE_APP_ASSETS_PATH;
1413
// const CodeMirror = {};
1514

1615
// make cm global so modes can properly register
@@ -62,7 +61,7 @@ CodeMirror.requireMode = (mode, cont, reject) => {
6261
script.onerror = () => reject(Error('No internet'));
6362
script.async = true;
6463
console.log('WTF');
65-
script.src = `${assetsPath || ''}/cm/mode/${mode}/${mode}.js${assetsPath ? '.gz' : ''}`;
64+
script.src = `${process.env.VUE_APP_ASSETS_PATH || ''}/cm/mode/${mode}/${mode}.js.gz`;
6665
console.log(`loading: ${script.src}`);
6766
const others = document.getElementsByTagName('script')[0];
6867
loading[mode] = [cont];
@@ -112,7 +111,7 @@ const loadTheme = (name = 'material-darker') => {
112111

113112
if (!existing) {
114113
const link = document.createElement('link');
115-
link.href = `${assetsPath || ''}/cm/theme/${name}.css${assetsPath ? '.gz' : ''}`;
114+
link.href = `${process.env.VUE_APP_ASSETS_PATH || ''}/cm/theme/${name}.cs.gz`;
116115
link.rel = 'stylesheet';
117116
link.id = name;
118117
document.head.appendChild(link);

vue.config.js

+21-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const webpack = require('webpack')
21
const zopfli = require('@gfx/zopfli');
32
const fs = require('fs');
43
// const StatsPlugin = require('stats-webpack-plugin');
@@ -25,10 +24,14 @@ module.exports = {
2524
},
2625
},
2726
pluginOptions: {
27+
copy: {
28+
globOptions: {
29+
ignore: ['**/material-darker.css']
30+
}
31+
},
2832
compression: {
2933
zopfli: {
3034
filename: '[path]',
31-
// deleteOriginalAssets: true,
3235
include: /\.gz$/,
3336
exclude: /cm\//,
3437
compressionOptions: {
@@ -54,23 +57,26 @@ module.exports = {
5457
},
5558
plugins: [
5659
// new StatsPlugin('stats.json'),
57-
new webpack.IgnorePlugin({resourceRegExp: /public\/cm\//,}),
5860
]
5961
},
60-
// chainWebpack(config) {
62+
chainWebpack(config) {
63+
config.plugin('copy').tap(options => {
64+
options[0][0].ignore.push('**/material-darker.css');
65+
return options;
66+
});
6167
// config.plugins.delete('prefetch');
62-
// },
68+
},
6369
devServer: {
64-
proxy: 'http://127.0.0.1:3000',
65-
// {
66-
// '^/': {
67-
// target: 'http://127.0.0.1:3000',
68-
// changeOrgin: true,
69-
// ws: true,
70-
// secure: false,
71-
// logLevel: 'debug',
72-
// },
73-
// },
70+
proxy: {
71+
'(^/database.json$)|(^/socket\.io/)|(^/cm/)': {
72+
target: 'http://localhost:3000',
73+
changeOrgin: true,
74+
ws: true,
75+
secure: false,
76+
logLevel: 'debug',
77+
},
78+
79+
},
7480
progress: true,
7581
compress: false,
7682
// https: assetsPath ? false : {

0 commit comments

Comments
 (0)