1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
const path = require('path');
const IS_EE = require('../../../config/helpers/is_ee_env');
// controls --------------------------------------------------------------------
const HTML_TO_REMOVE = [
'style',
'script',
'link[rel="stylesheet"]',
'.content-wrapper',
'#js-peek',
'.modal',
'.feature-highlight',
// The user has to open up the responsive nav, so we don't need it on load
'.top-nav-responsive',
// We don't want to capture all the children of a dropdown-menu
'.dropdown-menu',
];
const CSS_TO_REMOVE = [
'.tooltip',
'.tooltip.show',
'.fa',
'.gl-accessibility:focus',
'.toasted-container',
'body .toasted-container.bottom-left',
'.popover',
'.with-performance-bar .navbar-gitlab',
'.text-secondary',
/\.feature-highlight-popover-content/,
/\.commit/,
/\.md/,
/\.with-performance-bar/,
];
const APPLICATION_CSS_PREFIX = 'application';
const APPLICATION_DARK_CSS_PREFIX = 'application_dark';
const UTILITIES_CSS_PREFIX = 'application_utilities';
const UTILITIES_DARK_CSS_PREFIX = 'application_utilities_dark';
// paths -----------------------------------------------------------------------
const ROOT = path.resolve(__dirname, '../../..');
const ROOT_RAILS = IS_EE ? path.join(ROOT, 'ee') : ROOT;
const FIXTURES_FOLDER_NAME = IS_EE ? 'fixtures-ee' : 'fixtures';
const FIXTURES_ROOT = path.join(ROOT, 'tmp/tests/frontend', FIXTURES_FOLDER_NAME);
const PATH_SIGNIN_HTML = path.join(FIXTURES_ROOT, 'startup_css/sign-in.html');
const PATH_SIGNIN_OLD_HTML = path.join(FIXTURES_ROOT, 'startup_css/sign-in-old.html');
const PATH_ASSETS = path.join(ROOT, 'tmp/startup_css_assets');
const PATH_STARTUP_SCSS = path.join(ROOT_RAILS, 'app/assets/stylesheets/startup');
// helpers ---------------------------------------------------------------------
const createMainOutput = ({ outFile, cssKeys, type }) => ({
outFile,
htmlPaths: [
path.join(FIXTURES_ROOT, `startup_css/project-${type}.html`),
path.join(FIXTURES_ROOT, `startup_css/project-${type}-signed-out.html`),
path.join(FIXTURES_ROOT, `startup_css/project-${type}-search-ff-off.html`),
],
cssKeys,
purgeOptions: {
safelist: {
standard: [
'page-with-icon-sidebar',
'sidebar-collapsed-desktop',
// We want to include the root dropdown-menu style since it should be hidden by default
'dropdown-menu',
],
// We want to include the identicon backgrounds
greedy: [/^bg[0-9]$/],
},
},
});
const OUTPUTS = [
createMainOutput({
type: 'general',
outFile: 'startup-general',
cssKeys: [APPLICATION_CSS_PREFIX, UTILITIES_CSS_PREFIX],
}),
createMainOutput({
type: 'dark',
outFile: 'startup-dark',
cssKeys: [APPLICATION_DARK_CSS_PREFIX, UTILITIES_DARK_CSS_PREFIX],
}),
{
outFile: 'startup-signin',
htmlPaths: [PATH_SIGNIN_HTML, PATH_SIGNIN_OLD_HTML],
cssKeys: [APPLICATION_CSS_PREFIX, UTILITIES_CSS_PREFIX],
purgeOptions: {
safelist: {
standard: ['fieldset', 'hidden'],
deep: [/login-page$/],
},
},
},
];
module.exports = {
HTML_TO_REMOVE,
CSS_TO_REMOVE,
APPLICATION_CSS_PREFIX,
APPLICATION_DARK_CSS_PREFIX,
UTILITIES_CSS_PREFIX,
UTILITIES_DARK_CSS_PREFIX,
ROOT,
PATH_ASSETS,
PATH_STARTUP_SCSS,
OUTPUTS,
};
|