@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -179
- package/.prettierrc +6 -6
- package/README.md +1028 -951
- package/bin/cli.js +483 -483
- package/cert/Tsicsezwild-22-23.crt +37 -37
- package/cert/Tsicsezwild-22-23.key +27 -27
- package/docs/CustomChunks.md +26 -26
- package/docs/DevStart.md +18 -18
- package/docs/HoverActive.md +12 -12
- package/docs/InstallNode.md +28 -28
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +678 -0
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/babel/cmjs-plugins-presets.js +0 -4
- package/lib/babel/es-plugins-presets.js +0 -4
- package/lib/common/getEntries.js +0 -10
- package/lib/common/getPublicPathConfig.js +0 -6
- package/lib/common/index.js +0 -5
- package/lib/common/splitChunks.js +2 -13
- package/lib/common/sslcertUpdater.js +6 -17
- package/lib/common/templateParameters.js +0 -2
- package/lib/common/testPattern.js +10 -21
- package/lib/common/valueReplacer.js +0 -15
- package/lib/configs/jest.config.js +8 -21
- package/lib/configs/libAlias.js +11 -2
- package/lib/configs/webpack.component.umd.config.js +0 -5
- package/lib/configs/webpack.css.umd.config.js +5 -13
- package/lib/configs/webpack.dev.config.js +13 -24
- package/lib/configs/webpack.docs.config.js +6 -12
- package/lib/configs/webpack.impact.config.js +6 -10
- package/lib/configs/webpack.prod.config.js +15 -26
- package/lib/hooks/docsProptypeHook.js +3 -7
- package/lib/jest/commitedFilesResult.js +3 -45
- package/lib/jest/coverageCollector.js +0 -11
- package/lib/jest/jsonMaker.js +0 -6
- package/lib/jest/preProcessors/cssPreprocessor.js +14 -13
- package/lib/jest/preProcessors/jsPreprocessor.js +0 -2
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +0 -3
- package/lib/jest/result.js +0 -22
- package/lib/jest/run.js +6 -17
- package/lib/jest/setup.js +5 -57
- package/lib/loaderUtils/configsAssetsLoaders.js +34 -44
- package/lib/loaderUtils/getCSSLoaders.js +41 -28
- package/lib/loaderUtils/getDevJsLoaders.js +0 -8
- package/lib/loaderUtils/index.js +0 -3
- package/lib/loaders/docsLoader.js +0 -7
- package/lib/loaders/docsPropsLoader.js +3 -7
- package/lib/loaders/fileBountryLoader.js +0 -2
- package/lib/loaders/fileLoader.js +11 -22
- package/lib/loaders/scriptInstrumentLoader.js +5 -13
- package/lib/loaders/selectorMappingLoader.js +7 -25
- package/lib/loaders/workerLoader.js +13 -29
- package/lib/middlewares/HMRMiddleware.js +13 -26
- package/lib/middlewares/SSTMiddleware.js +0 -3
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +53 -0
- package/lib/pluginUtils/getDevPlugins.js +20 -64
- package/lib/pluginUtils/getDocsPlugins.js +1 -10
- package/lib/pluginUtils/getLibraryImactPlugins.js +4 -5
- package/lib/pluginUtils/getLibraryPlugins.js +0 -5
- package/lib/pluginUtils/getProdPlugins.js +32 -78
- package/lib/pluginUtils/getServerPlugins.js +0 -5
- package/lib/pluginUtils/getUMDCSSPlugins.js +0 -7
- package/lib/pluginUtils/getUMDComponentPlugins.js +0 -7
- package/lib/pluginUtils/index.js +0 -8
- package/lib/plugins/CdnChangePlugin.js +0 -14
- package/lib/plugins/CleanupStatsPlugin.js +0 -5
- package/lib/plugins/EFCPlugin.js +23 -34
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +23 -32
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -38
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +12 -17
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +46 -77
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +44 -59
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +21 -30
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +70 -80
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +0 -6
- package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +2 -20
- package/lib/plugins/ManifestPlugin.js +0 -17
- package/lib/plugins/ModuleStatsPlugin.js +0 -23
- package/lib/plugins/OptimizeJSPlugin.js +0 -7
- package/lib/plugins/PublicPathCallbackPlugin.js +0 -10
- package/lib/plugins/PublicPathChangePlugin.js +4 -36
- package/lib/plugins/ReportGeneratePlugin.js +4 -30
- package/lib/plugins/RequireVariablePublicPlugin.js +0 -6
- package/lib/plugins/ResourceHintsPlugin.js +20 -27
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +23 -38
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
- package/lib/plugins/ScriptInstrumentPlugin.js +0 -7
- package/lib/plugins/ServiceWorkerPlugin.js +13 -29
- package/lib/plugins/ShadowDOMSupportPlugin.js +3 -40
- package/lib/plugins/SourceMapHookPlugin.js +0 -9
- package/lib/plugins/TPHashMappingPlugin.js +5 -19
- package/lib/plugins/UglifyCSSPlugin.js +0 -9
- package/lib/plugins/UnusedFilesFindPlugin.js +2 -35
- package/lib/plugins/index.js +0 -19
- package/lib/plugins/libraryImpactPlugin.js +0 -32
- package/lib/plugins/webpackwatchrunplugin.js +0 -5
- package/lib/postcss-plugins/ExcludePlugin.js +0 -4
- package/lib/postcss-plugins/RTLSplitPlugin.js +24 -37
- package/lib/postcss-plugins/ValueReplacer.js +9 -6
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +80 -92
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +31 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +232 -0
- package/lib/postcss-plugins/variableModifier.js +14 -20
- package/lib/schemas/index.js +28 -13
- package/lib/servers/clusterHubServer.js +0 -10
- package/lib/servers/devBuild.js +13 -24
- package/lib/servers/docsServer.js +0 -2
- package/lib/servers/docsServerCore.js +0 -21
- package/lib/servers/getCliPath.js +1 -10
- package/lib/servers/helpServer.js +0 -5
- package/lib/servers/httpsOptions.js +0 -4
- package/lib/servers/impactServer.js +2 -34
- package/lib/servers/mockserver.js +0 -9
- package/lib/servers/nowatchserver.js +12 -34
- package/lib/servers/scrServer.js +13 -20
- package/lib/servers/server.js +7 -35
- package/lib/servers/ssServer.js +0 -16
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/CoverageScriptTemplate.js +0 -14
- package/lib/templates/WMSTemplate.js +6 -12
- package/lib/utils/babelPresets.js +0 -2
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/clean.js +2 -8
- package/lib/utils/copy.js +0 -6
- package/lib/utils/copyTimezones.js +0 -8
- package/lib/utils/createEventStream.js +0 -4
- package/lib/utils/cssClassNameGenerate.js +3 -19
- package/lib/utils/cssURLReplacer.js +0 -25
- package/lib/utils/dependencyPostPublish.js +0 -9
- package/lib/utils/fileUtils.js +0 -26
- package/lib/utils/folderIterator.js +0 -10
- package/lib/utils/getComponents.js +0 -21
- package/lib/utils/getCurrentBranch.js +0 -5
- package/lib/utils/getDependenciesImpactList.js +0 -21
- package/lib/utils/getHash.js +0 -7
- package/lib/utils/getIp.js +0 -2
- package/lib/utils/getOptions.js +38 -35
- package/lib/utils/getServerURL.js +0 -7
- package/lib/utils/index.js +2 -47
- package/lib/utils/init.js +0 -1
- package/lib/utils/initPreCommitHook.js +6 -29
- package/lib/utils/jsonHelper.js +2 -19
- package/lib/utils/libraryImpactConfig.js +0 -2
- package/lib/utils/lint/addScripts.js +2 -5
- package/lib/utils/lint/checkExistingConfig.js +3 -12
- package/lib/utils/lint/copyConfigs.js +0 -3
- package/lib/utils/lint/index.js +0 -9
- package/lib/utils/lint/lintScripts.js +0 -1
- package/lib/utils/lint/lintSetup.js +3 -4
- package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
- package/lib/utils/lint/question.js +0 -7
- package/lib/utils/lintReporter.js +0 -20
- package/lib/utils/mailSender.js +0 -7
- package/lib/utils/pullOrigin.js +0 -4
- package/lib/utils/reinstallDependencies.js +0 -28
- package/lib/utils/removeAttributes.js +0 -7
- package/lib/utils/repoClone.js +2 -27
- package/lib/utils/request.js +0 -12
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +4 -16
- package/lib/utils/setEnvVariables.js +0 -2
- package/lib/utils/ssTestHack.js +0 -10
- package/lib/utils/switchBranch.js +0 -4
- package/lib/utils/urlConcat.js +0 -4
- package/lib/utils/useExitCleanup.js +9 -10
- package/npm8.md +9 -9
- package/package.json +146 -148
- package/postpublish.js +6 -6
- package/templates/app/.eslintrc.js +140 -140
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -24
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -18
- package/templates/app/package.json +37 -37
- package/templates/app/src/actions/SampleActions/index.js +37 -37
- package/templates/app/src/actions/index.js +65 -65
- package/templates/app/src/appUrls.js +19 -19
- package/templates/app/src/components/Alert/Alert.js +134 -134
- package/templates/app/src/components/Alert/Alert.module.css +79 -79
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
- package/templates/app/src/components/Sample/Sample.module.css +11 -11
- package/templates/app/src/components/Sample/SampleList.js +61 -61
- package/templates/app/src/components/Slider/Slider.css +41 -41
- package/templates/app/src/components/Slider/Slider.js +55 -55
- package/templates/app/src/containers/AlertContainer/index.js +15 -15
- package/templates/app/src/containers/AppContainer/index.js +96 -96
- package/templates/app/src/containers/AppContainer/index.module.css +27 -27
- package/templates/app/src/containers/CustomMatch/index.js +65 -65
- package/templates/app/src/containers/DevTools/index.js +10 -10
- package/templates/app/src/containers/Header/index.js +67 -67
- package/templates/app/src/containers/Header/index.module.css +43 -43
- package/templates/app/src/containers/Redirect/index.js +63 -63
- package/templates/app/src/containers/Redirector/index.js +47 -47
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
- package/templates/app/src/historyChange.js +5 -5
- package/templates/app/src/index.html +10 -10
- package/templates/app/src/index.js +24 -24
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
- package/templates/app/src/reducers/alertData.js +11 -11
- package/templates/app/src/reducers/index.js +6 -6
- package/templates/app/src/reducers/samples.js +19 -19
- package/templates/app/src/store/configureStore.dev.js +51 -51
- package/templates/app/src/store/configureStore.js +5 -5
- package/templates/app/src/store/configureStore.prod.js +26 -26
- package/templates/app/src/util/Common.js +5 -5
- package/templates/app/src/util/RequestAPI.js +132 -132
- package/templates/docs/all.html +249 -249
- package/templates/docs/component.html +178 -178
- package/templates/docs/components.html +221 -221
- package/templates/docs/css/b.min.css +6 -6
- package/templates/docs/css/component.css +42 -42
- package/templates/docs/css/componentTest.css +6 -6
- package/templates/docs/css/hopscotch.css +585 -585
- package/templates/docs/css/style.css +1022 -1022
- package/templates/docs/impactReportTemplate.html +154 -154
- package/templates/docs/index.html +1501 -1493
- package/templates/docs/js/active-line.js +72 -72
- package/templates/docs/js/b.min.js +7 -7
- package/templates/docs/js/codemirror.js +9680 -9680
- package/templates/docs/js/designTokens.js +334 -334
- package/templates/docs/js/j.min.js +4 -4
- package/templates/docs/js/javascript.js +874 -874
- package/templates/docs/js/matchbrackets.js +145 -145
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
# Variable Conversion
|
|
2
|
+
|
|
3
|
+
<!-- file paths :
|
|
4
|
+
|
|
5
|
+
# react - cli :
|
|
6
|
+
src\postcss-plugins\variableModificationPlugin\index.js
|
|
7
|
+
|
|
8
|
+
# source folder :
|
|
9
|
+
jsapps\supportapp\cssVariableReplacementOptions.json ( options json file )
|
|
10
|
+
jsapps\supportapp\plugins\pxParserPostcss.js ( px parsing as a process before plugin conversion to custom css variables in react -cli )
|
|
11
|
+
jsapps\supportapp\plugins\variableIgnore.js ( adding variable:ignore comment to ignore the line for any conversion beforehand to preserve the declaration )
|
|
12
|
+
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
# Added support for Properties ( Cut 1 ) :
|
|
16
|
+
|
|
17
|
+
* font-size
|
|
18
|
+
* margin
|
|
19
|
+
* margin-top
|
|
20
|
+
* margin-bottom
|
|
21
|
+
* margin-left
|
|
22
|
+
* margin-right
|
|
23
|
+
* padding
|
|
24
|
+
* padding-top
|
|
25
|
+
* padding-bottom
|
|
26
|
+
* padding-left
|
|
27
|
+
* padding-right
|
|
28
|
+
* top
|
|
29
|
+
* right
|
|
30
|
+
* bottom
|
|
31
|
+
* left
|
|
32
|
+
* width
|
|
33
|
+
* min-width
|
|
34
|
+
* max-width
|
|
35
|
+
* height
|
|
36
|
+
* min-height
|
|
37
|
+
* max-height
|
|
38
|
+
|
|
39
|
+
# Css variable conversion consists of three steps :
|
|
40
|
+
|
|
41
|
+
. addition of comment variable:ignore for the seperation of values to be considered for the conversion and the ones that are not to be considered for conversion. ( `variableIgnore.js` )
|
|
42
|
+
. conversion of the variable from current css variables to corresponding px value manually. ( `pxParserPostcss.js` )
|
|
43
|
+
. conversion of the resultant px values to custom variables present in settings ( `cssVariableReplacementOptions.json` )
|
|
44
|
+
|
|
45
|
+
`cssVariableReplacementOptions.json example` :
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"errorLog": false,
|
|
50
|
+
"errorInConsole": false,
|
|
51
|
+
"errorsAllowed":{
|
|
52
|
+
"DECLARATION_IGNORED" : true,
|
|
53
|
+
"UNIT_ERROR" : true,
|
|
54
|
+
"RANGE_ERROR" : true,
|
|
55
|
+
"VARIABLE_PRESENT" : true
|
|
56
|
+
},
|
|
57
|
+
"settings": {
|
|
58
|
+
"font-size": {
|
|
59
|
+
"allowed": [
|
|
60
|
+
"px",
|
|
61
|
+
"em",
|
|
62
|
+
"%",
|
|
63
|
+
"0",
|
|
64
|
+
"vh",
|
|
65
|
+
"initial"
|
|
66
|
+
],
|
|
67
|
+
"replacements": {
|
|
68
|
+
"px": "var(--zd_font_size$$)",
|
|
69
|
+
"em": "var(--zd_font_size$$em)"
|
|
70
|
+
},
|
|
71
|
+
"range": {
|
|
72
|
+
"start": 0,
|
|
73
|
+
"end": 1650
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"margin": {
|
|
77
|
+
"allowed": [
|
|
78
|
+
"px",
|
|
79
|
+
"em",
|
|
80
|
+
"fit-content",
|
|
81
|
+
"auto",
|
|
82
|
+
"%",
|
|
83
|
+
"inherit",
|
|
84
|
+
"-moz-fit-content",
|
|
85
|
+
"vh",
|
|
86
|
+
"0",
|
|
87
|
+
"initial",
|
|
88
|
+
"vw"
|
|
89
|
+
],
|
|
90
|
+
"replacements": {
|
|
91
|
+
"px": "var(--zd_size$$)"
|
|
92
|
+
},
|
|
93
|
+
"range": {
|
|
94
|
+
"start": -1650,
|
|
95
|
+
"end": 1650
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"margin-left": {
|
|
99
|
+
"allowed": [
|
|
100
|
+
"px",
|
|
101
|
+
"em",
|
|
102
|
+
"fit-content",
|
|
103
|
+
"auto",
|
|
104
|
+
"%",
|
|
105
|
+
"inherit",
|
|
106
|
+
"-moz-fit-content",
|
|
107
|
+
"vh",
|
|
108
|
+
"0",
|
|
109
|
+
"initial",
|
|
110
|
+
"vw"
|
|
111
|
+
],
|
|
112
|
+
"replacements": {
|
|
113
|
+
"px": "var(--zd_size$$)"
|
|
114
|
+
},
|
|
115
|
+
"range": {
|
|
116
|
+
"start": -1650,
|
|
117
|
+
"end": 1650
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"margin-right": {
|
|
121
|
+
"allowed": [
|
|
122
|
+
"px",
|
|
123
|
+
"em",
|
|
124
|
+
"fit-content",
|
|
125
|
+
"auto",
|
|
126
|
+
"%",
|
|
127
|
+
"inherit",
|
|
128
|
+
"-moz-fit-content",
|
|
129
|
+
"vh",
|
|
130
|
+
"0",
|
|
131
|
+
"initial",
|
|
132
|
+
"vw"
|
|
133
|
+
],
|
|
134
|
+
"replacements": {
|
|
135
|
+
"px": "var(--zd_size$$)"
|
|
136
|
+
},
|
|
137
|
+
"range": {
|
|
138
|
+
"start": -1650,
|
|
139
|
+
"end": 1650
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"margin-top": {
|
|
143
|
+
"allowed": [
|
|
144
|
+
"px",
|
|
145
|
+
"em",
|
|
146
|
+
"fit-content",
|
|
147
|
+
"auto",
|
|
148
|
+
"%",
|
|
149
|
+
"inherit",
|
|
150
|
+
"-moz-fit-content",
|
|
151
|
+
"vh",
|
|
152
|
+
"0",
|
|
153
|
+
"initial",
|
|
154
|
+
"vw"
|
|
155
|
+
],
|
|
156
|
+
"replacements": {
|
|
157
|
+
"px": "var(--zd_size$$)"
|
|
158
|
+
},
|
|
159
|
+
"range": {
|
|
160
|
+
"start": -1650,
|
|
161
|
+
"end": 1650
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"margin-bottom": {
|
|
165
|
+
"allowed": [
|
|
166
|
+
"px",
|
|
167
|
+
"em",
|
|
168
|
+
"fit-content",
|
|
169
|
+
"auto",
|
|
170
|
+
"%",
|
|
171
|
+
"inherit",
|
|
172
|
+
"-moz-fit-content",
|
|
173
|
+
"vh",
|
|
174
|
+
"0",
|
|
175
|
+
"initial",
|
|
176
|
+
"vw"
|
|
177
|
+
],
|
|
178
|
+
"replacements": {
|
|
179
|
+
"px": "var(--zd_size$$)"
|
|
180
|
+
},
|
|
181
|
+
"range": {
|
|
182
|
+
"start": -1650,
|
|
183
|
+
"end": 1650
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"padding": {
|
|
187
|
+
"allowed": [
|
|
188
|
+
"px",
|
|
189
|
+
"em",
|
|
190
|
+
"fit-content",
|
|
191
|
+
"auto",
|
|
192
|
+
"%",
|
|
193
|
+
"inherit",
|
|
194
|
+
"-moz-fit-content",
|
|
195
|
+
"vh",
|
|
196
|
+
"0",
|
|
197
|
+
"initial",
|
|
198
|
+
"vw"
|
|
199
|
+
],
|
|
200
|
+
"replacements": {
|
|
201
|
+
"px": "var(--zd_size$$)"
|
|
202
|
+
},
|
|
203
|
+
"range": {
|
|
204
|
+
"start": -1650,
|
|
205
|
+
"end": 1650
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"padding-left": {
|
|
209
|
+
"allowed": [
|
|
210
|
+
"px",
|
|
211
|
+
"em",
|
|
212
|
+
"fit-content",
|
|
213
|
+
"auto",
|
|
214
|
+
"%",
|
|
215
|
+
"inherit",
|
|
216
|
+
"-moz-fit-content",
|
|
217
|
+
"vh",
|
|
218
|
+
"0",
|
|
219
|
+
"initial",
|
|
220
|
+
"vw"
|
|
221
|
+
],
|
|
222
|
+
"replacements": {
|
|
223
|
+
"px": "var(--zd_size$$)"
|
|
224
|
+
},
|
|
225
|
+
"range": {
|
|
226
|
+
"start": -1650,
|
|
227
|
+
"end": 1650
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"padding-right": {
|
|
231
|
+
"allowed": [
|
|
232
|
+
"px",
|
|
233
|
+
"em",
|
|
234
|
+
"fit-content",
|
|
235
|
+
"auto",
|
|
236
|
+
"%",
|
|
237
|
+
"inherit",
|
|
238
|
+
"-moz-fit-content",
|
|
239
|
+
"vh",
|
|
240
|
+
"0",
|
|
241
|
+
"initial",
|
|
242
|
+
"vw"
|
|
243
|
+
],
|
|
244
|
+
"replacements": {
|
|
245
|
+
"px": "var(--zd_size$$)"
|
|
246
|
+
},
|
|
247
|
+
"range": {
|
|
248
|
+
"start": -1650,
|
|
249
|
+
"end": 1650
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"padding-top": {
|
|
253
|
+
"allowed": [
|
|
254
|
+
"px",
|
|
255
|
+
"em",
|
|
256
|
+
"fit-content",
|
|
257
|
+
"auto",
|
|
258
|
+
"%",
|
|
259
|
+
"inherit",
|
|
260
|
+
"-moz-fit-content",
|
|
261
|
+
"vh",
|
|
262
|
+
"0",
|
|
263
|
+
"initial",
|
|
264
|
+
"vw"
|
|
265
|
+
],
|
|
266
|
+
"replacements": {
|
|
267
|
+
"px": "var(--zd_size$$)"
|
|
268
|
+
},
|
|
269
|
+
"range": {
|
|
270
|
+
"start": -1650,
|
|
271
|
+
"end": 1650
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"padding-bottom": {
|
|
275
|
+
"allowed": [
|
|
276
|
+
"px",
|
|
277
|
+
"em",
|
|
278
|
+
"fit-content",
|
|
279
|
+
"auto",
|
|
280
|
+
"%",
|
|
281
|
+
"inherit",
|
|
282
|
+
"-moz-fit-content",
|
|
283
|
+
"vh",
|
|
284
|
+
"0",
|
|
285
|
+
"initial",
|
|
286
|
+
"vw"
|
|
287
|
+
],
|
|
288
|
+
"replacements": {
|
|
289
|
+
"px": "var(--zd_size$$)"
|
|
290
|
+
},
|
|
291
|
+
"range": {
|
|
292
|
+
"start": -1650,
|
|
293
|
+
"end": 1650
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"height": {
|
|
297
|
+
"allowed": [
|
|
298
|
+
"px",
|
|
299
|
+
"em",
|
|
300
|
+
"fit-content",
|
|
301
|
+
"auto",
|
|
302
|
+
"%",
|
|
303
|
+
"inherit",
|
|
304
|
+
"-moz-fit-content",
|
|
305
|
+
"vh",
|
|
306
|
+
"0",
|
|
307
|
+
"initial",
|
|
308
|
+
"vw"
|
|
309
|
+
],
|
|
310
|
+
"replacements": {
|
|
311
|
+
"px": "var(--zd_size$$)"
|
|
312
|
+
},
|
|
313
|
+
"range": {
|
|
314
|
+
"start": -1650,
|
|
315
|
+
"end": 1650
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"width": {
|
|
319
|
+
"allowed": [
|
|
320
|
+
"px",
|
|
321
|
+
"em",
|
|
322
|
+
"fit-content",
|
|
323
|
+
"auto",
|
|
324
|
+
"%",
|
|
325
|
+
"inherit",
|
|
326
|
+
"-moz-fit-content",
|
|
327
|
+
"vh",
|
|
328
|
+
"0",
|
|
329
|
+
"initial",
|
|
330
|
+
"vw"
|
|
331
|
+
],
|
|
332
|
+
"replacements": {
|
|
333
|
+
"px": "var(--zd_size$$)"
|
|
334
|
+
},
|
|
335
|
+
"range": {
|
|
336
|
+
"start": -1650,
|
|
337
|
+
"end": 1650
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"min-width": {
|
|
341
|
+
"allowed": [
|
|
342
|
+
"px",
|
|
343
|
+
"em",
|
|
344
|
+
"fit-content",
|
|
345
|
+
"auto",
|
|
346
|
+
"%",
|
|
347
|
+
"inherit",
|
|
348
|
+
"-moz-fit-content",
|
|
349
|
+
"vh",
|
|
350
|
+
"0",
|
|
351
|
+
"initial",
|
|
352
|
+
"vw"
|
|
353
|
+
],
|
|
354
|
+
"replacements": {
|
|
355
|
+
"px": "var(--zd_size$$)"
|
|
356
|
+
},
|
|
357
|
+
"range": {
|
|
358
|
+
"start": -1650,
|
|
359
|
+
"end": 1650
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"max-width": {
|
|
363
|
+
"allowed": [
|
|
364
|
+
"px",
|
|
365
|
+
"em",
|
|
366
|
+
"fit-content",
|
|
367
|
+
"auto",
|
|
368
|
+
"%",
|
|
369
|
+
"inherit",
|
|
370
|
+
"-moz-fit-content",
|
|
371
|
+
"vh",
|
|
372
|
+
"0",
|
|
373
|
+
"initial",
|
|
374
|
+
"vw"
|
|
375
|
+
],
|
|
376
|
+
"replacements": {
|
|
377
|
+
"px": "var(--zd_size$$)"
|
|
378
|
+
},
|
|
379
|
+
"range": {
|
|
380
|
+
"start": -1650,
|
|
381
|
+
"end": 1650
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
"min-height": {
|
|
385
|
+
"allowed": [
|
|
386
|
+
"px",
|
|
387
|
+
"em",
|
|
388
|
+
"fit-content",
|
|
389
|
+
"auto",
|
|
390
|
+
"%",
|
|
391
|
+
"inherit",
|
|
392
|
+
"-moz-fit-content",
|
|
393
|
+
"vh",
|
|
394
|
+
"0",
|
|
395
|
+
"initial",
|
|
396
|
+
"vw"
|
|
397
|
+
],
|
|
398
|
+
"replacements": {
|
|
399
|
+
"px": "var(--zd_size$$)"
|
|
400
|
+
},
|
|
401
|
+
"range": {
|
|
402
|
+
"start": -1650,
|
|
403
|
+
"end": 1650
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"max-height": {
|
|
407
|
+
"allowed": [
|
|
408
|
+
"px",
|
|
409
|
+
"em",
|
|
410
|
+
"fit-content",
|
|
411
|
+
"auto",
|
|
412
|
+
"%",
|
|
413
|
+
"inherit",
|
|
414
|
+
"-moz-fit-content",
|
|
415
|
+
"vh",
|
|
416
|
+
"0",
|
|
417
|
+
"initial",
|
|
418
|
+
"vw"
|
|
419
|
+
],
|
|
420
|
+
"replacements": {
|
|
421
|
+
"px": "var(--zd_size$$)"
|
|
422
|
+
},
|
|
423
|
+
"range": {
|
|
424
|
+
"start": -1650,
|
|
425
|
+
"end": 1650
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
"top": {
|
|
429
|
+
"allowed": [
|
|
430
|
+
"px",
|
|
431
|
+
"em",
|
|
432
|
+
"fit-content",
|
|
433
|
+
"auto",
|
|
434
|
+
"%",
|
|
435
|
+
"inherit",
|
|
436
|
+
"-moz-fit-content",
|
|
437
|
+
"vh",
|
|
438
|
+
"0",
|
|
439
|
+
"initial",
|
|
440
|
+
"vw"
|
|
441
|
+
],
|
|
442
|
+
"replacements": {
|
|
443
|
+
"px": "var(--zd_size$$)"
|
|
444
|
+
},
|
|
445
|
+
"range": {
|
|
446
|
+
"start": -1650,
|
|
447
|
+
"end": 1650
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"bottom": {
|
|
451
|
+
"allowed": [
|
|
452
|
+
"px",
|
|
453
|
+
"em",
|
|
454
|
+
"fit-content",
|
|
455
|
+
"auto",
|
|
456
|
+
"%",
|
|
457
|
+
"inherit",
|
|
458
|
+
"-moz-fit-content",
|
|
459
|
+
"vh",
|
|
460
|
+
"0",
|
|
461
|
+
"initial",
|
|
462
|
+
"vw"
|
|
463
|
+
],
|
|
464
|
+
"replacements": {
|
|
465
|
+
"px": "var(--zd_size$$)"
|
|
466
|
+
},
|
|
467
|
+
"range": {
|
|
468
|
+
"start": -1650,
|
|
469
|
+
"end": 1650
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
"left": {
|
|
473
|
+
"allowed": [
|
|
474
|
+
"px",
|
|
475
|
+
"em",
|
|
476
|
+
"fit-content",
|
|
477
|
+
"auto",
|
|
478
|
+
"%",
|
|
479
|
+
"inherit",
|
|
480
|
+
"-moz-fit-content",
|
|
481
|
+
"vh",
|
|
482
|
+
"0",
|
|
483
|
+
"initial",
|
|
484
|
+
"vw"
|
|
485
|
+
],
|
|
486
|
+
"replacements": {
|
|
487
|
+
"px": "var(--zd_size$$)"
|
|
488
|
+
},
|
|
489
|
+
"range": {
|
|
490
|
+
"start": -1650,
|
|
491
|
+
"end": 1650
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
"right": {
|
|
495
|
+
"allowed": [
|
|
496
|
+
"px",
|
|
497
|
+
"em",
|
|
498
|
+
"fit-content",
|
|
499
|
+
"auto",
|
|
500
|
+
"%",
|
|
501
|
+
"inherit",
|
|
502
|
+
"-moz-fit-content",
|
|
503
|
+
"vh",
|
|
504
|
+
"0",
|
|
505
|
+
"initial",
|
|
506
|
+
"vw"
|
|
507
|
+
],
|
|
508
|
+
"replacements": {
|
|
509
|
+
"px": "var(--zd_size$$)"
|
|
510
|
+
},
|
|
511
|
+
"range": {
|
|
512
|
+
"start": -1650,
|
|
513
|
+
"end": 1650
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
Step 1 : Adding variable:ignore
|
|
521
|
+
|
|
522
|
+
use command `npm run variable:addignore` on source folder
|
|
523
|
+
|
|
524
|
+
before :
|
|
525
|
+
```css
|
|
526
|
+
.a{
|
|
527
|
+
font-size: var(--zd_size14);
|
|
528
|
+
margin: var(--zd_size12);
|
|
529
|
+
padding: 12px;
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
after :
|
|
534
|
+
|
|
535
|
+
```css
|
|
536
|
+
/* explanation : since padding has declaration in px instead of var, it is considered unique and thereby no conversion should take place, hence we add variable:ignore preceding the line */
|
|
537
|
+
.a{
|
|
538
|
+
font-size: var(--zd_size14);
|
|
539
|
+
margin: var(--zd_size12);
|
|
540
|
+
/*Variable:Ignore*/
|
|
541
|
+
padding: 12px;
|
|
542
|
+
}
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
Step 2 : Converting vars to px
|
|
546
|
+
|
|
547
|
+
use command `npm run variable:convert` on source folder
|
|
548
|
+
|
|
549
|
+
before :
|
|
550
|
+
```css
|
|
551
|
+
.a{
|
|
552
|
+
font-size: var(--zd_size14);
|
|
553
|
+
margin: var(--zd_size12);
|
|
554
|
+
/*Variable:Ignore*/
|
|
555
|
+
padding: 12px;
|
|
556
|
+
}
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
after :
|
|
560
|
+
```css
|
|
561
|
+
/* explanation : conversion from vars to px is done making the declarations convertable to custom variables further by the react-cli plugin*/
|
|
562
|
+
.a{
|
|
563
|
+
font-size: 14px;
|
|
564
|
+
margin: 12px;
|
|
565
|
+
/*Variable:Ignore*/
|
|
566
|
+
padding: 12px;
|
|
567
|
+
}
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
Step 3 : Conversion from px to custom variables present in settings
|
|
571
|
+
|
|
572
|
+
Things that are considered in the conversion :
|
|
573
|
+
=> `allowed` is the allowed units that can be converted through the plugin
|
|
574
|
+
=> `replacements` are the conversion strings where `$$` will be converted to respective numbers
|
|
575
|
+
=> `range` is the starting and ending value within numbers will be allowed.
|
|
576
|
+
|
|
577
|
+
`variableModificationPlugin` in react-cli folder is where the conversion takes place.
|
|
578
|
+
|
|
579
|
+
and output would be as follows :
|
|
580
|
+
|
|
581
|
+
before :
|
|
582
|
+
|
|
583
|
+
```css
|
|
584
|
+
/* explanation : conversion from px to variable is allowed since, all the conditions for font-size and margin are satisfied, the numbers are within range and the unit is in the allowed array, replacements are thereby taken from the values in replacements and conversion is done to custom variables */
|
|
585
|
+
|
|
586
|
+
/*
|
|
587
|
+
"font-size": {
|
|
588
|
+
"allowed": [
|
|
589
|
+
"px",
|
|
590
|
+
"em",
|
|
591
|
+
"%",
|
|
592
|
+
"0",
|
|
593
|
+
"vh",
|
|
594
|
+
"initial"
|
|
595
|
+
],
|
|
596
|
+
"replacements": {
|
|
597
|
+
"px": "var(--zd_font_size$$)",
|
|
598
|
+
"em": "var(--zd_font_size$$em)"
|
|
599
|
+
},
|
|
600
|
+
"range": {
|
|
601
|
+
"start": 0,
|
|
602
|
+
"end": 1650
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
*/
|
|
606
|
+
/*
|
|
607
|
+
|
|
608
|
+
"margin": {
|
|
609
|
+
"allowed": [
|
|
610
|
+
"px",
|
|
611
|
+
"em",
|
|
612
|
+
"fit-content",
|
|
613
|
+
"auto",
|
|
614
|
+
"%",
|
|
615
|
+
"inherit",
|
|
616
|
+
"-moz-fit-content",
|
|
617
|
+
"vh",
|
|
618
|
+
"0",
|
|
619
|
+
"initial",
|
|
620
|
+
"vw"
|
|
621
|
+
],
|
|
622
|
+
"replacements": {
|
|
623
|
+
"px": "var(--zd_size$$)"
|
|
624
|
+
},
|
|
625
|
+
"range": {
|
|
626
|
+
"start": -1650,
|
|
627
|
+
"end": 1650
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
|
|
631
|
+
*/
|
|
632
|
+
.a{
|
|
633
|
+
font-size: 14px;
|
|
634
|
+
margin: 12px;
|
|
635
|
+
/*Variable:Ignore*/
|
|
636
|
+
padding: 12px;
|
|
637
|
+
}
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
after :
|
|
641
|
+
|
|
642
|
+
```css
|
|
643
|
+
|
|
644
|
+
.a{
|
|
645
|
+
font-size: var(--zd_size14);
|
|
646
|
+
margin: var(--zd_size12);
|
|
647
|
+
/*Variable:Ignore*/
|
|
648
|
+
padding: 12px;
|
|
649
|
+
}
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
Output configuration :
|
|
653
|
+
|
|
654
|
+
Consider the below mentioned :
|
|
655
|
+
```json
|
|
656
|
+
"errorLog": false,
|
|
657
|
+
"errorInConsole": false,
|
|
658
|
+
"errorsAllowed":{
|
|
659
|
+
"DECLARATION_IGNORED" : true,
|
|
660
|
+
"UNIT_ERROR" : true,
|
|
661
|
+
"RANGE_ERROR" : true,
|
|
662
|
+
"VARIABLE_PRESENT" : true
|
|
663
|
+
},
|
|
664
|
+
```
|
|
665
|
+
. if an error log is necessary, a physical file `css_error.log` will be created in the source directory upon making `errorLog` true. will take generally more than usual time to write in the file, so delay in build is present.
|
|
666
|
+
|
|
667
|
+
. if error is needed to be seen in the console, `errorInConsole` should be enabled, all errors will be printed in the console.
|
|
668
|
+
|
|
669
|
+
. Individual errors can be enabled in `errorsAllowed` to collaboratively produce the error log file / errors in console. Here each of the errors mean the following :
|
|
670
|
+
|
|
671
|
+
=> `DECLARATION_IGNORED` : Lines that succeed the /*Variable:Ignore*/ comment.
|
|
672
|
+
=> `UNIT_ERROR` : the units that are not present in the corresponding property's `allowed` array are used.
|
|
673
|
+
=> `RANGE_ERROR` : numerical values that are not present within the range of the corresponding property's `range` is used.
|
|
674
|
+
=> `VARIABLE_PRESENT` : conversion to px (Step 2) wasn't done properly and hence there are residues that contain `var` in it are found.
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
* First two conversions are to be done manually by the use of the commands, `npm run variable:addignore` and `npm run variable:convert`
|
|
678
|
+
* Final conversion is done by react-cli on compilation of the source folder `npm run start --app:port=**** --app:domain=****`
|