Base64Coder
Installing
You can install base64coder using npm:
$ npm install base64coder
Info
This library will help you encode data to hide it after building in source.
Using:
1.Create a file with export data (name ex.: 'data.loader.js').
Example:
const data1 = 'header': 'What is the capital of Russia?' 'questions': 'text': 'Moscow' 'isRight': true ; const data2 = 'title': 'JS or JSON?' 'text': 'This is page created for ...'; // Need for export data in loader (create variable with name base64data)var base64data = data1 data2;moduleexports = base64data;
2.Import data in your controller and decode method.
; ; { console;}; { console;};
3.Webpack.
Add loader for your js files with mask. You can choose any mask.
... module: { rules: [{ test: /\.loader.js$/, use: [{ loader: 'base64coder', }] }, ... ],}
Min version
You can use a minified version:
- In loader change name
'base64coder'
to'base64coder/index.min.js'
; - In controller change import lib from
import decode from 'base64coder/decode';
toimport decode from 'base64coder/decode.min';
In the future minified version will be basic.
Examples
You can open examples (click on candy image):