-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathproductionify.js
52 lines (46 loc) · 1.17 KB
/
productionify.js
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
/**
* @license
*
* Copyright (c) 2018-present, Abdón Rodríguez Davila (@abdonrd).
*
* This source code is licensed under the MIT license found in the LICENSE file
* in the root directory of this source tree.
*/
/* eslint-env node */
/* eslint-disable no-console */
const replace = require('replace-in-file');
const options = {
files: [
'src/app-shell.html',
'sw-precache-config.js'
],
from: 'abdonrd-develop',
to: 'abdonrd'
};
replace(options)
.then(changes => {
console.log('Modified files:');
console.log(changes);
})
.catch(error => {
console.error('Error occurred:', error);
});
const options2 = {
files: 'index.html',
from: '<!-- google-analytics-tracking-code -->',
to: `<script async src="https://www.googletagmanager.com/gtag/js?id=UA-72184997-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-72184997-1');
</script>`
};
replace(options2)
.then(changes => {
console.log('Modified files:');
console.log(changes);
})
.catch(error => {
console.error('Error occurred:', error);
});