You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-9Lines changed: 24 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -97,6 +97,7 @@ const defaultOptions = {
97
97
formatJson:false, // Format obfuscation data JSON file.
98
98
showConfig:false, // Show config on terminal when runinng.
99
99
keepData:true, // Keep or delete Data after obfuscation is finished?
100
+
preRun: () =>Promise.resolve(), // do something before the plugin runs.
100
101
callBack:function () {}, // Callback function to call after obfuscation is done.
101
102
};
102
103
```
@@ -127,7 +128,8 @@ const defaultOptions = {
127
128
-**`formatJson:`** Format obfuscation data JSON file, **default is false.**
128
129
-**`showConfig:`** Show config on terminal when runinng, **default is false.**
129
130
-**`keepData:`** Keep or delete data after obfuscation is finished? **default is true.**
130
-
-**`callBack:`** Callback function to call after obfuscation is done. **default is an empty function**
131
+
-**`preRun:`** Do something before the plugin runs. **default is a promise that immediately resolves.**
132
+
-**`callBack:`** Callback function to call after obfuscation is done. **default is an empty function.**
131
133
132
134
## npm scripts example
133
135
@@ -161,6 +163,13 @@ Then npm scripts can be something like this:
161
163
162
164
It's better to keep your source files as they are for easy development. Consider specifying another folder for the build, if you choose your build directory to be the same as the source directory you will be replaced and you will lose your original files.
163
165
166
+
### Support for CSS framworks?
167
+
168
+
It's designed to work with CSS, hence its supports any framework you can think of:
169
+
- Tailwindcss.
170
+
- Bootstrap.
171
+
- Bulma.
172
+
- ... .
164
173
### Use indicators?
165
174
166
175
As mentioned this plugin uses Regex to replace all appearances of classes & ids on files with extensions you specify (be it html, cs, js, ...).
So basically you use `callBack` option to set the env mode back to `production` thus obfuscation will not run, and then config your app source folder to use `out` folder instead of `src` for production.
229
238
230
-
### Support for CSS framworks?
231
-
232
-
It's designed to work with CSS, hence its supports any framework you can think of:
233
-
- Tailwindcss.
234
-
- Bootstrap.
235
-
- Bulma.
236
-
- ... .
239
+
### Run plugin after some tasks are finished?
237
240
241
+
You can use the `preRun` event hook option to delay the plugin until a certain task is finished or to perform some operation before the plugin runs. This option provides greater control over the timing of the plugin's execution and allows you to ensure that any necessary pre-processing or post-processing is completed before or after the plugin runs.
242
+
```js
243
+
preRun: () =>newPromise(resolve=>setTimeout(resolve, 10000)), // delay for 10s.
244
+
```
245
+
```js
246
+
preRun: () => {
247
+
returnnewPromise(resolve=> {
248
+
// some pre-tasks
249
+
resolve();
250
+
});
251
+
}
252
+
```
238
253
### How To Use With?
239
254
Are you struggling to use it with your tooling & stack environment? please create an Issue. We will be happy to help.
240
255
@@ -328,7 +343,7 @@ group
328
343
- Fix #9 update regex match exact wording.
329
344
- Fix #10 obfuscation only works for indicators.
330
345
- Set Indicators Start & End.
331
-
- Add beforeRun event hook option.
346
+
- Add PreRun event hook option.
332
347
- Draft for orderJson option.
333
348
- Discard draft: Force option (case: dev env or same Path).
0 commit comments